Hey Everyone! Please help me, it's so serious! I would like to make a code for a shutter control in C++, here's the code:
void setup() { Serial.begin(9600); pinMode(8, OUTPUT); pinMode(9, OUTPUT); pinMode(10, OUTPUT); pinMode(11, OUTPUT); //digitalWrite(11, HIGH); } void loop() { commandState = analogRead(A0); Serial.println(commandState); if(commandState == 0 && commandState <20){ digitalWrite(11, HIGH); digitalWrite(10, LOW); digitalWrite(9, LOW); digitalWrite(8, LOW); } else if(commandState > 683 && commandState < 723) { digitalWrite(11, LOW); digitalWrite(10, HIGH); digitalWrite(9, LOW); digitalWrite(8, LOW); } else if(commandState > 94 && commandState < 134) { digitalWrite(11, LOW); digitalWrite(10, LOW); digitalWrite(9, HIGH); digitalWrite(8, LOW); } else if(commandState > 394 && commandState < 434) { digitalWrite(11, LOW); digitalWrite(10, LOW); digitalWrite(9, LOW); digitalWrite(8, HIGH); } delay(50); }