mirror of
https://github.com/hzkincony/kc868-arduino-library.git
synced 2024-11-09 23:28:26 +01:00
29 lines
417 B
C++
29 lines
417 B
C++
#include "KC868.h"
|
|
|
|
|
|
KC868 kc868(&Serial2); //create kc868 object
|
|
|
|
void SwitchUpdate(uint8_t idx, uint8_t state)
|
|
{
|
|
Serial.printf("Switch %d : %d\n",idx,state);//state ,0:switch off , 1: switch on
|
|
|
|
}
|
|
|
|
void setup() {
|
|
|
|
Serial.begin(115200);
|
|
|
|
delay(2000);
|
|
|
|
kc868.begin(115200);//begin kc868 with baud 115200
|
|
|
|
kc868.setSwitchChangeHook(SwitchUpdate);//set switch change hook
|
|
|
|
}
|
|
|
|
|
|
void loop(){
|
|
|
|
kc868.poll();
|
|
|
|
} |