//////////////////////////////////////////////////////////////////////////////////
int SW;
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(A0, INPUT_PULLUP);
pinMode(A1, OUTPUT);
pinMode(A2, OUTPUT);
pinMode(A3, OUTPUT);
pinMode(A4, OUTPUT);//A4=SDA
pinMode(A5, OUTPUT);//A5=SCL
}
// the loop function runs over and over again forever
void loop() {
SW=digitalRead(A0);
if(SW==LOW){
digitalWrite(A1, HIGH);
digitalWrite(A2, HIGH);
digitalWrite(A3, HIGH);
digitalWrite(A4, HIGH);//A4=SDA
digitalWrite(A5, HIGH);//A5=SCL
delay(1000); // wait for a second
digitalWrite(A1, LOW);
digitalWrite(A2, LOW);
digitalWrite(A3, LOW);
digitalWrite(A4, LOW);//A4=SDA
digitalWrite(A5, LOW);//A5=SCL
delay(1000); // wait for a second
}
}
ARDUINO #7 เทคนิคเพิ่มขาดิจิตอลเป็น20ขา A4 as SDA. A5 as SCL. PIN CAN USE AS DIGITAL
22/1/2563 SONGCHAI
PRAPATRUNGSEE
ไม่มีความคิดเห็น:
แสดงความคิดเห็น