fork download
  1. #define IN4 4
  2. #define IN5 5
  3. #define IN6 6
  4. #define IN7 7
  5.  
  6. #define An1 A1
  7. #define An2 A2
  8.  
  9. void setup()
  10. {
  11. pinMode (IN4, OUTPUT);
  12. pinMode (IN5, OUTPUT);
  13. pinMode (IN6, OUTPUT);
  14. pinMode (IN7, OUTPUT);
  15.  
  16. pinMode (An1, INPUT);
  17. pinMode (An2, INPUT);
  18.  
  19. analogWrite (An1, HIGH);
  20.  
  21. }
  22.  
  23. void loop()
  24.  
  25. {
  26. if (digitalRead(An1) == LOW){
  27. digitalWrite (IN4, HIGH); //Назат/вперед
  28. digitalWrite (IN5, HIGH); //ВКЛ/ВЫКЛ
  29. digitalWrite (IN6, HIGH); //ВКЛ/ВЫКЛ
  30. digitalWrite (IN7, HIGH); //Назат/Вперед
  31. }
  32. else
  33. {
  34. digitalWrite (IN4, LOW); //Назат/вперед
  35. digitalWrite (IN5, HIGH); //ВКЛ/ВЫКЛ
  36. digitalWrite (IN6, HIGH); //ВКЛ/ВЫКЛ
  37. digitalWrite (IN7, HIGH); //Назат/Вперед
  38. }
  39.  
  40. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘void setup()’:
prog.cpp:11:15: error: ‘OUTPUT’ was not declared in this scope
 pinMode (IN4, OUTPUT);
               ^~~~~~
prog.cpp:11:21: error: ‘pinMode’ was not declared in this scope
 pinMode (IN4, OUTPUT);
                     ^
prog.cpp:6:13: error: ‘A1’ was not declared in this scope
 #define An1 A1
             ^
prog.cpp:16:10: note: in expansion of macro ‘An1’
 pinMode (An1, INPUT);
          ^~~
prog.cpp:16:15: error: ‘INPUT’ was not declared in this scope
 pinMode (An1, INPUT);
               ^~~~~
prog.cpp:7:13: error: ‘A2’ was not declared in this scope
 #define An2 A2
             ^
prog.cpp:17:10: note: in expansion of macro ‘An2’
 pinMode (An2, INPUT);
          ^~~
prog.cpp:19:19: error: ‘HIGH’ was not declared in this scope
 analogWrite (An1, HIGH);
                   ^~~~
prog.cpp:19:23: error: ‘analogWrite’ was not declared in this scope
 analogWrite (An1, HIGH);
                       ^
prog.cpp: In function ‘void loop()’:
prog.cpp:6:13: error: ‘A1’ was not declared in this scope
 #define An1 A1
             ^
prog.cpp:26:17: note: in expansion of macro ‘An1’
 if (digitalRead(An1) == LOW){
                 ^~~
prog.cpp:26:20: error: ‘digitalRead’ was not declared in this scope
 if (digitalRead(An1) == LOW){
                    ^
prog.cpp:26:25: error: ‘LOW’ was not declared in this scope
 if (digitalRead(An1) == LOW){
                         ^~~
prog.cpp:27:22: error: ‘HIGH’ was not declared in this scope
   digitalWrite (IN4, HIGH); //Назат/вперед
                      ^~~~
prog.cpp:27:26: error: ‘digitalWrite’ was not declared in this scope
   digitalWrite (IN4, HIGH); //Назат/вперед
                          ^
prog.cpp:34:25: error: ‘digitalWrite’ was not declared in this scope
   digitalWrite (IN4, LOW); //Назат/вперед
                         ^
prog.cpp:35:22: error: ‘HIGH’ was not declared in this scope
   digitalWrite (IN5, HIGH); //ВКЛ/ВЫКЛ
                      ^~~~
stdout
Standard output is empty