12345678910111213141516171819202122 |
- #define PIN_IO 12
- int touch_val = 0;
- void setup() {
- pinMode(PIN_IO,INPUT);
- pinMode(LED_BUILTIN, OUTPUT);
-
- Serial.begin(115200);
- }
- void loop() {
- touch_val = digitalRead(PIN_IO);
- digitalWrite(LED_BUILTIN,touch_val);
- if(touch_val == HIGH){
- Serial.println("BS=1");
- Serial.write(1);
- }else{
- Serial.println("BS=0");
- Serial.write(1);
- }
- delay(1000);
- }
|