06-01-2022, 01:11 AM
[Arduino IDE demo source code for KC868-A8S]--#01-KC868-A8S_433_receive_code
Code:
/* RF-receive code for KC868-A8S*/
/*If receive the RF single,the LED will be turn the color to "0xff00ff"*/
/*install library RCSwitch and Adafruit_NeoPixel*/
#include <RCSwitch.h> //Install library "rcswitch"
#include <Adafruit_NeoPixel.h>
Adafruit_NeoPixel rgb_display = Adafruit_NeoPixel(130,12,NEO_GRB + NEO_KHZ800);
//The WS2812 rgb LED is connect to IO12 RGB_LED number is 1
RCSwitch mySwitch = RCSwitch();
void setup() {
Serial.begin(9600);
rgb_display.begin();
mySwitch.enableReceive(digitalPinToInterrupt(16)); //receive PIN IO16
}
void loop() {
if (mySwitch.available()) {
Serial.print("Received ");
Serial.println( mySwitch.getReceivedValue() );
rgb_display.setPixelColor((1)-1,(0xff00ff));
rgb_display.setBrightness(100);
rgb_display.show();
}
mySwitch.resetAvailable();
}