Smart Home Automation Forum
[Arduino IDE demo source code for KC868-A8S]--#01-KC868-A8S_433_receive_code - Printable Version

+- Smart Home Automation Forum (https://www.kincony.com/forum)
+-- Forum: Technical Support (https://www.kincony.com/forum/forumdisplay.php?fid=20)
+--- Forum: KC868-A8S (https://www.kincony.com/forum/forumdisplay.php?fid=24)
+--- Thread: [Arduino IDE demo source code for KC868-A8S]--#01-KC868-A8S_433_receive_code (/showthread.php?tid=1950)



[Arduino IDE demo source code for KC868-A8S]--#01-KC868-A8S_433_receive_code - KinCony Support - 06-01-2022

[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();   
}