int pir = 0;
int count =0;
String vel;
int bus=0;
void setup() {
pinMode(9, INPUT);
pinMode(2, OUTPUT);
Serial.begin(9600);
// put your setup code here, to run once:
}
void loop() {
vel =Serial.readString();
if(vel=="count\n"){
Serial.println(count);
}
pir = digitalRead(9);
if (pir == HIGH){
digitalWrite(2, HIGH);
if(bus==0){
Serial.println("motion");
count = count+1;
bus = 1;
}
}
if(pir == LOW){
digitalWrite(2,LOW);
if(bus==1){
bus=0;
}
// Serial.println("nooo");
}
// if(Serial.readString()=="count"){
// Serial.println(count);
// }
// put your main code here, to run repeatedly:
}