Johan wrote:
Göran, how are you testing that it's working?
/ Johan
It’s actually Goran, but I see why you guessed with dots on the o = ö 😎
Well I consider it as working since I get the right codes on the serial monitor when pressing different buttons. In addition I wrote a small program (sketch on arduino language (see below)) which checks for incoming signals and then compare them to the codes in the commands.h file, e.g if 7 is pressed in Light mode a “light #1 on” signal is sent to the 433MHz transmitter and if the 4 on beo4 is pressed in same mode the same lamp is turned off. And this works. So I haven’t stress tested the code (wouldn’t know how to either) but it seems to me that it works, so far every press on one button gives the same code, and no code is received as from noise.
Still a bit confused as to what the tick really is, I changed from 625 to 125 but 200 works as well. I would expect it to be more sensitive to changes if this is actually the counter that interprets the signal. Will read this link as soon as I press post.
What would you suggest as an alternative to this way of reading IR code, and what is the risk with this non robust way of doing it. Do I risk getting wrong codes or missing incoming or getting false signals…
The code:
#include <Beomote.h>
#include <rf433.h>
int irPin = 10;
int clickCount = 0;
bool serialOut = true;
void setup() {
Serial.begin(9600);
Beo.initialize(irPin);
set_out_pin(2); // Set pin RF sender is connected to.
}
void loop() {
BeoCommand cmd;
if (Beo.receive(cmd)) {
//Serial.print(cmd.link, HEX);
//Serial.print(cmd.address, HEX);
//Serial.println(cmd.command, HEX);
if (cmd.address == 0x1B && cmd.command == 0x07){
int light_id = 1;
int on = 1;
for(int i=0; i < 4; i++) {
send(switches[light_id], on ? ON : OFF);
delay(80);
}
}
else if (cmd.address == 0x1B && cmd.command == 0x04){
int light_id = 1;
int on = 0;
for(int i=0; i < 4; i++) {
send(switches[light_id], on ? ON : OFF);
delay(80);
}
}
}
}