kc868-arduino-library/examples/06-read-all-relay-state/06-read-all-relay-state.ino
2022-10-09 11:23:51 +08:00

23 lines
426 B
C++

#include "KC868.h"
KC868 kc868(&Serial2); //create kc868 object
void setup() {
Serial.begin(115200);
delay(2000);
kc868.begin(115200);//begin kc868 with baud 115200
uint32_t ret = kc868.readSwitchAll(); //read all relay state
Serial.printf("relay state is 0x%08x.\n",ret); //32 bit value,the highest bit is the state of relay 32, and the lowest bit is the state of relay 1
}
void loop(){
kc868.poll();
}