Today we worked on the movement sensor in ordre to turn right and left. We used the following code:
void setup() {
pinMode(7,INPUT);
Serial.begin(9600);
int a=0;
}
void loop() {
int a=0;
Serial.print("IRSensorip ");
Serial.println(digitalRead(7));
if(digitalRead(7)==0){
a=0;
Serial.println(a);
delay(10);
}
else{
a=1;
Serial.println(a);
delay(10);
}
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.