int r = 2;
int g = 3;
int y = 4;
int Gbtn = 5;
int Ybtn = 6;
int Rbtn = 7;
void setup() {
// put your setup code here, to run once:
// กำหนดรูปแบบขา
pinMode(r, OUTPUT);
pinMode(g, OUTPUT);
pinMode(y, OUTPUT);
Serial.begin(115200);
pinMode(Gbtn, INPUT);
pinMode(Ybtn, INPUT);
pinMode(Rbtn, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
bool GbtnV = digitalRead(Gbtn);
bool YbtnV = digitalRead(Ybtn);
bool RbtnV = digitalRead(Rbtn);
Serial.print(GbtnV);
Serial.print("\t");
Serial.print(YbtnV);
Serial.print("\t");
Serial.println(RbtnV);
digitalWrite(g, GbtnV);
digitalWrite(y, YbtnV);
digitalWrite(r, RbtnV);
delay(100);
}