Hi I'm Sam, new to the forum and fairly new to Arduino but enjoying what is able to be done with one!
I wonder if anyone could help though as I have searched the internet trying to find how you use the data received from a readymade 433mhz remote sending to the Arduino but all I can find is the code to listen not how to then use it.
My project consists of a 3 button remote that originally came with a receiver that controlled on, off and PWM dimming of a led strip but the receiver chip has stopped working so I am now trying to use a Arduino and a cheap Ebay 433mhz receiver to accomplish the same task, my problem is I thought after finding the code my remote outputs that it was as easy as using a "if" statement but it seems not and I can only find code and tutorials on how to listen to the signals not use them to control outputs.
If anyone could explain how I can use the data from my receiver I would be very grateful
This is the code I was trying to use, it receives and prints to serial fine but I guess I cant use if statements here?
#include <RemoteReceiver.h>
int led = 13;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
// start the remote receiver using interrupt 0 (pin 2)
RemoteReceiver::start(0);
pinMode(led, OUTPUT);
int code = RemoteReceiver::getData();
//digitalWrite(led, HIGH);
}
void loop() {
if(RemoteReceiver::dataReady()){
Serial.print("Read: ");
Serial.println(RemoteReceiver::getData());
int code = RemoteReceiver::getData();
if (code == 11528308) {
digitalWrite(led, HIGH);
}
if (code == 11528306) {
digitalWrite(led, LOW);
}
}
}
Thanks in advance
Sam
if (code == 11528308)
This won't work, because "code" is declared integer and can have values only from -32768 to 32767.
For that line to work "code" must be declared long, and getdata() must also return a long.
Where did you get the RemoteReceiver library?
Do you know for sure that it will decode your remote?
Hi jremington, thanks for the reply!
I looked at several libraries online where people were using the same type of ebay remote as me so I just downloaded whichever they used and the remote switch was one of them but all the sketches I can find never show how to use the received transmitter input only to re transmit it somewhere else etc.
this is where I found that library:
I have also used others which all ouput the same codes from my remote anyway, I will attach 3 screenshots below of different sketches and outputs as I press each of the 3 remote buttons if that helps.
What im looking to have it do is use the RF input to control the outputs on a nano or attiny, I can figure out the pwm and function side of things with trial and error but I just couldn't find online how you use the incoming RF signal when using a ready built transmitter.
also I opened up my transmitter and its running a ev1527 ic if that helps?
I am very new to arduino so any help you can give is much apriciated!
how do I see if the library function is declared long?
Thanks in advance
Sam
No, that library did not come from that link. There is no function named getData().
int code = RemoteReceiver::getData();
Try changing "int" to "long".
Thanks jremington!
It didn't work with the remotereceiver library but it works with the RCswitch one so I will use that for my project using the "long" variable
Time to go figure out the rest of my code now.
Many thanks for the help and I hope once I learn more about arduino I can help others too.
Sam