//problem 1 you need to put ( , ) after pinMode x, to work.
{ //problem. { //Solution.
pinMode(13 OUTPUT); pinMode(13, OUTPUT);
pinMode(8 INPUT); pinMode(8, INPUT);
pinMode(12 INPUT); } pinMode(12, INPUT); }
// commas after the Numbers if u don't u get this error.
In file included from sketch\sketch_jul16a.ino.cpp:1:0:
C:\Users\Simon\Desktop\sketch_jul15a\sketch_jul16a\sketch_jul16a.ino: In function 'void setup()':
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:44:16: error: expected ')' before numeric constant
#define OUTPUT 0x1
^
C:\Users\Simon\Desktop\sketch_jul15a\sketch_jul16a\sketch_jul16a.ino:5:15: note: in expansion of macro 'OUTPUT'
pinMode(13 OUTPUT);
^~~~~~
sketch_jul16a:5:21: error: too few arguments to function 'void pinMode(uint8_t, uint8_t)'
pinMode(13 OUTPUT);
^
In file included from sketch\sketch_jul16a.ino.cpp:1:0:
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:134:6: note: declared here
void pinMode(uint8_t pin, uint8_t mode);
^~~~~~~
In file included from sketch\sketch_jul16a.ino.cpp:1:0:
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:43:15: error: expected ')' before numeric constant
#define INPUT 0x0
^
C:\Users\Simon\Desktop\sketch_jul15a\sketch_jul16a\sketch_jul16a.ino:6:14: note: in expansion of macro 'INPUT'
pinMode(8 INPUT);
^~~~~
sketch_jul16a:6:19: error: too few arguments to function 'void pinMode(uint8_t, uint8_t)'
pinMode(8 INPUT);
^
In file included from sketch\sketch_jul16a.ino.cpp:1:0:
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:134:6: note: declared here
void pinMode(uint8_t pin, uint8_t mode);
^~~~~~~
In file included from sketch\sketch_jul16a.ino.cpp:1:0:
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:43:15: error: expected ')' before numeric constant
#define INPUT 0x0
^
C:\Users\Simon\Desktop\sketch_jul15a\sketch_jul16a\sketch_jul16a.ino:7:15: note: in expansion of macro 'INPUT'
pinMode(12 INPUT);
^~~~~
sketch_jul16a:7:20: error: too few arguments to function 'void pinMode(uint8_t, uint8_t)'
pinMode(12 INPUT);
^
In file included from sketch\sketch_jul16a.ino.cpp:1:0:
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:134:6: note: declared here
void pinMode(uint8_t pin, uint8_t mode);
^~~~~~~
exit status 1
too few arguments to function 'void pinMode(uint8_t, uint8_t)'
//problem 2 set int global so if u don't set int ass global your arguments want function
//so how to set int global u put it before
void setup()
//exempel
( int qe = 0;
void setup()
{
pinMode(13, OUTPUT);
pinMode(8, INPUT);
pinMode(12, INPUT);
Serial.begin(2400);
} )
// end you need to check your math
//exempel
( qe = qe + 1; )
//full code
[code]
int qe = 0;
void setup()
{
pinMode(13, OUTPUT);
pinMode(8, INPUT);
pinMode(12, INPUT);
Serial.begin(2400);
}
void loop()
{
int inpu = digitalRead(8);
int id = digitalRead(12);
if (inpu == HIGH)
{
qe = qe + 1;
}
else if (id == HIGH)
{
qe = 0;
}
else if (qe >= 1)
{
digitalWrite(13, HIGH);
}
else if (qe <= 0)
{
digitalWrite(13, LOW);
}
Serial.println(qe);
delay(1);
}
[/code]
Could you please clarify what you mean by broken?
I will make an assumption that your variables are not updating in loop. This is because you update i and l once only in setup().
Once this is done, the variables are not being updated in loop().
What you may want to try is:
// global declaration before setup
const int i = 8;
consrt int l = 9;
//in loop
if ( digitalRead (i) >= HIGH ){ qe + 1 ;}
else if ( digitalRead (l) >= HIGH ){ qe == 0;}
Note:
the variables i and l look very similar to each other and will cause unexpected confusion later. Give them long names
Arduino: 1.8.19 (Windows Store 1.8.57.0) (Windows 10), Board: "Arduino Uno"
In file included from sketch\sketch_jul19a.ino.cpp:1:0:
C:\Users\Simon\Desktop\sketch_jul15a\sketch_jul19a\sketch_jul19a.ino: In function 'void setup()':
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:44:16: error: expected ')' before numeric constant
#define OUTPUT 0x1
^
C:\Users\Simon\Desktop\sketch_jul15a\sketch_jul19a\sketch_jul19a.ino:2:13: note: in expansion of macro 'OUTPUT'
pinMode(12 OUTPUT);
^~~~~~
sketch_jul19a:2:19: error: too few arguments to function 'void pinMode(uint8_t, uint8_t)'
pinMode(12 OUTPUT);
^
In file included from sketch\sketch_jul19a.ino.cpp:1:0:
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:134:6: note: declared here
void pinMode(uint8_t pin, uint8_t mode);
^~~~~~~
In file included from sketch\sketch_jul19a.ino.cpp:1:0:
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:44:16: error: expected ')' before numeric constant
#define OUTPUT 0x1
^
C:\Users\Simon\Desktop\sketch_jul15a\sketch_jul19a\sketch_jul19a.ino:3:13: note: in expansion of macro 'OUTPUT'
pinMode(13 OUTPUT);
^~~~~~
sketch_jul19a:3:19: error: too few arguments to function 'void pinMode(uint8_t, uint8_t)'
pinMode(13 OUTPUT);
^
In file included from sketch\sketch_jul19a.ino.cpp:1:0:
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:134:6: note: declared here
void pinMode(uint8_t pin, uint8_t mode);
^~~~~~~
In file included from sketch\sketch_jul19a.ino.cpp:1:0:
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:43:15: error: expected ')' before numeric constant
#define INPUT 0x0
^
C:\Users\Simon\Desktop\sketch_jul15a\sketch_jul19a\sketch_jul19a.ino:4:14: note: in expansion of macro 'INPUT'
pinMode(8 INPUT);
^~~~~
sketch_jul19a:4:19: error: too few arguments to function 'void pinMode(uint8_t, uint8_t)'
pinMode(8 INPUT);
^
In file included from sketch\sketch_jul19a.ino.cpp:1:0:
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:134:6: note: declared here
void pinMode(uint8_t pin, uint8_t mode);
^~~~~~~
In file included from sketch\sketch_jul19a.ino.cpp:1:0:
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:43:15: error: expected ')' before numeric constant
#define INPUT 0x0
^
C:\Users\Simon\Desktop\sketch_jul15a\sketch_jul19a\sketch_jul19a.ino:5:14: note: in expansion of macro 'INPUT'
pinMode(9 INPUT);
^~~~~
sketch_jul19a:5:19: error: too few arguments to function 'void pinMode(uint8_t, uint8_t)'
pinMode(9 INPUT);
^
In file included from sketch\sketch_jul19a.ino.cpp:1:0:
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:134:6: note: declared here
void pinMode(uint8_t pin, uint8_t mode);
^~~~~~~
C:\Users\Simon\Desktop\sketch_jul15a\sketch_jul19a\sketch_jul19a.ino: In function 'void loop()':
sketch_jul19a:13:6: error: 'i' was not declared in this scope
if ( i = HIGH ){ qe += 1 ;}
^
sketch_jul19a:13:19: error: 'qe' was not declared in this scope
if ( i = HIGH ){ qe += 1 ;}
^~
sketch_jul19a:14:11: error: 'l' was not declared in this scope
else if ( l = HIGH ){ qe = 0;}
^
sketch_jul19a:14:23: error: 'qe' was not declared in this scope
else if ( l = HIGH ){ qe = 0;}
^~
sketch_jul19a:15:11: error: 'qe' was not declared in this scope
else if ( qe >= 1){ digitalWrite( 13 HIGH ); }
^~
In file included from sketch\sketch_jul19a.ino.cpp:1:0:
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:40:14: error: expected ')' before numeric constant
#define HIGH 0x1
^
C:\Users\Simon\Desktop\sketch_jul15a\sketch_jul19a\sketch_jul19a.ino:15:39: note: in expansion of macro 'HIGH'
else if ( qe >= 1){ digitalWrite( 13 HIGH ); }
^~~~
sketch_jul19a:15:44: error: too few arguments to function 'void digitalWrite(uint8_t, uint8_t)'
else if ( qe >= 1){ digitalWrite( 13 HIGH ); }
^
In file included from sketch\sketch_jul19a.ino.cpp:1:0:
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:135:6: note: declared here
void digitalWrite(uint8_t pin, uint8_t val);
^~~~~~~~~~~~
In file included from sketch\sketch_jul19a.ino.cpp:1:0:
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:41:14: error: expected ')' before numeric constant
#define LOW 0x0
^
C:\Users\Simon\Desktop\sketch_jul15a\sketch_jul19a\sketch_jul19a.ino:16:39: note: in expansion of macro 'LOW'
else if (qe <= 0 ){ digitalWrite( 13 LOW ); }
^~~
sketch_jul19a:16:44: error: too few arguments to function 'void digitalWrite(uint8_t, uint8_t)'
else if (qe <= 0 ){ digitalWrite( 13 LOW ); }
^
In file included from sketch\sketch_jul19a.ino.cpp:1:0:
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:135:6: note: declared here
void digitalWrite(uint8_t pin, uint8_t val);
^~~~~~~~~~~~
exit status 1
too few arguments to function 'void pinMode(uint8_t, uint8_t)'
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Move these outside of setup() to make them global and they should NOT be constant:
const int qe = 0;
const int i = digitalRead(8) ;
const int l = digitalRead(9) ;
Multiple issues below:
'=' is assignment. '==' is comparison.
i and l never get changed during loop()
missing a comma in digitalWrite() calls
if ( i = HIGH ){ qe += 1 ;}
else if ( l = HIGH ){ qe = 0;}
else if ( qe >= 1){ digitalWrite( 13 HIGH ); }
else if (qe <= 0 ){ digitalWrite( 13 LOW ); }
In general:
avoid single character variables, with the possible exception in loops as an iterator
not sure about the else if statements because you have not described what you want your program to do
you need to work on understanding basic C++ program structure, semantics, and syntax
int qe = 0;
void setup()
{
pinMode(12, OUTPUT);
pinMode(LED_BUILTIN, OUTPUT);
pinMode(8, INPUT);
pinMode(9, INPUT);
}
void loop()
{
int i = digitalRead(8);
int l = digitalRead(9);
if (i == HIGH)
{
qe = qe + 1;
}
else if (l == HIGH)
{
qe = 0;
}
else if (qe >= 1)
{
digitalWrite(LED_BUILTIN, HIGH);
}
else if (qe <= 0)
{
digitalWrite(LED_BUILTIN, LOW);
}
}