#include <LiquidCrystal.h>
int BS1,BS2;
void setup()
{
pinMode(11, INPUT);
pinMode(10, INPUT);
pinMode(1,OUTPUT);
pinMode(0,OUTPUT);
}
void loop()
{
BS1 = digitalRead(11);BS2 = digitalRead(10);
if (BS1 == LOW) {
digitalWrite(0, HIGH);
digitalWrite(1, LOW);
lcd.setCursor(7, 0);
lcd.print("LEFT");
}
else if (BS2 == LOW) {digitalWrite(1, HIGH);
digitalWrite(0, LOW);
lcd.setCursor(7, 0);
lcd.print("right");
}
else {lcd.setCursor(5, 0);
lcd.print("++Stop++");
digitalWrite(0, LOW);
digitalWrite(1, LOW);;
}
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น