Smart Home Automation Forum
[Arduino IDE demo source code for KC868-SERVER]--#04-Key press code - Printable Version

+- Smart Home Automation Forum (https://www.kincony.com/forum)
+-- Forum: Technical Support (https://www.kincony.com/forum/forumdisplay.php?fid=1)
+--- Forum: KC868-Server Raspberry Pi4 local server (https://www.kincony.com/forum/forumdisplay.php?fid=17)
+--- Thread: [Arduino IDE demo source code for KC868-SERVER]--#04-Key press code (/showthread.php?tid=1851)



[Arduino IDE demo source code for KC868-SERVER]--#04-Key press code - KinCony Support - 04-22-2022

Code:
void setup() {
  Serial.begin(9600);
  pinMode(0,INPUT);// Key S5  is connected to IO0   set IO0 to input mode
}
void loop() {
  if(digitalRead(0)==LOW){
    Serial.println("Key S5 Pressed!");
    delay(100);
  }
  if(digitalRead(0)==HIGH){
   Serial.println("Key S5 Not Pressed!");
   delay(1000);
   }
}