Code
int PT1 = 13;
int PT2 = 12;
int BTS1 = 0;
int BTS2 = 0;
void setup() {
pinMode(2, OUTPUT);
pinMode(1, OUTPUT);
pinMode(PT1, INPUT);
pinMode(PT2, INPUT);
digitalWrite(1, LOW);
digitalWrite(2, LOW);
}
void loop() {
BTS1 = digitalRead(PT1);
BTS2 = digitalRead(PT2);
if(BTS1 == LOW){
digitalWrite(1, LOW);
digitalWrite(2, HIGH);
delay(50);
}
if(BTS2 == LOW){
digitalWrite(1, HIGH);
digitalWrite(2, LOW);
delay(50);
}
}
Code
void setup() {
pinMode(7 ,OUTPUT);
pinMode(6 ,OUTPUT);
}
void loop() {
digitalWrite(7 ,HIGH);
digitalWrite(6 ,LOW);
delay(1000);
digitalWrite(7 ,LOW);
digitalWrite(6 ,HIGH);
delay(1000);
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น