0
can someone please tell me how i can make a program, on the Arduino, that counts every time i read a specific analog value?
arduino counter
2 odpowiedzi
+ 3
int count = 0;
void loop() {
if(analogRead(A0)) {
count++;
}
}
+ 1
if i understood your question properly, it should look like this:
const int yourValue=345;
int counter=0;
void setup(){
Serial.begin(115200);
}
void loop(){
if (analogRead(A0)==yourValue){
counter++;
Serial.println(counter);
}
}