Hi Johan,
thanks for your reply. You are a great example of why I love the Arduino community Maybe I will keep the Flamingo set after your encouraging post (was thinking of returning it to the shop).
Unfortunately, your code is not compiling for me, I get
Flamingo_send.ino: In function 'void Flamingo_Send(int, int, int)':
Flamingo_send:59: error: 'sendcmd_error' was not declared in this scope
Flamingo_send:71: error: 'sendcmd_error' was not declared in this scope
Flamingo_send:87: error: 'sendcmd_error' was not declared in this scope
Flamingo_send:112: error: 'rfPin' was not declared in this scope
Like this, I get it to compile:
/******************************************************************************
** Flamingo_send **
** **
** Flamingo device commands (on/off)hard coded (not deciphered yet) **
** code is 28 byte long. To transfer it in 32 bit code 4 *0 **
** is added to the left. For programming reason hex code representation**
** of device code is used. E.g. Remote 0,C,On: **
** code 28 bits: 0001100110111111110100100110 **
** code 32 bits: 00011001101111111101001001100000 **
** Hex: 19BFD260 **
** **
** "Sync" 1 pulse High, 15 pulse low **
** "1" 1 pulse High, 3 pulse low **
** "0" 3 pulse High, 1 pulse low **
** "end" N/A **
** **
** For internal ref: Unit 0 = white remote , unit 1 = black remote **
** **
******************************************************************************/
// Compiler only coding
#define FREMOTE 2 /*amount supported remotes */
#define FUNITS 4 /* Amount of units supported per remote */
#define FCMDN 2 /* Amount of CMD 0 = On, 1 = Off */
int rfPin = 10;
// define device codes:
uint32_t fdev[FREMOTE][FUNITS][FCMDN] = {0xD9762A10, /* Remote 0, Unit A, On */
0xDAA47850, /* Remote 0, Unit A, Off */
0xDBDA22E0, /* Remote 0, Unit B, On */
0xDBA27220, /* Remote 0, Unit B, Off */
0x19BFD260, /* Remote 0, Unit C, On */
0x195EEAA0, /* Remote 0, Unit C, Off */
0x984CC650, /* Remote 0, Unit D, On */
0x9A8C1050, /* Remote 0, Unit D, Off */
0xDBFFFE90, /* Remote 1, Unit A, On */
0xD91CEF10, /* Remote 1, Unit A, Off */
0xDBC52FA0, /* Remote 1, Unit B, Aan */
0xD9E35160, /* Remote 1, Unit B, Off */
0x19B0FE60, /* Remote 1, Unit C, On */
0x19682B20, /* Remote 1, Unit C, Uit */
0x9924E7D0, /* Remote 1, Unit D, On */
0x9BA928D0 /* Remote 1, Unit D, Uit */
};
// Define Flamingo_send variables / constants
int fpulse = 300; /* Pulse witdh in microseconds */
int fretrans = 5; /* Code retransmission */
uint32_t fsendbuff;
uint32_t fdatabit;
uint32_t fdatamask = 0x80000000;
void Flamingo_Send(int fhousec, int funitc, int fcmd)
{
// Test if used codes are valid
if ((funitc < 1) || (funitc > 2)) { // check if unit code between 1-2 (Remote 0 of 1)
Serial.print("Unit error: ");
Serial.println(funitc);
return;
}
else {
funitc = funitc - 1; // To address right code in array
}
if ((fhousec < 0) || (fhousec > 3)) { // check if house code between 1-4 (A-D)
Serial.print("House error: ");
Serial.println(fhousec);
return;
}
if ((fcmd < 0) || (fcmd > 1)) { // check if command = 0 (off) or 1 (on)
Serial.print("Command error: ");
Serial.println(fcmd);
return;
}
//End test used codes
Serial.println("Send Flamingo command ");
Serial.print("Flamingo House/Device code = :");
Serial.println(fhousec);
Serial.print("Flamingo Unit/remote code = :");
Serial.println(funitc);
Serial.print("command = :");
Serial.println(fcmd);
Serial.println();
// Send Command
for (int nRepeat = 0; nRepeat <= fretrans; nRepeat++) {
fsendbuff = fdev[funitc][fhousec][fcmd];
// send SYNC 1P High, 15P low
Serial.println("Send sync");
digitalWrite(rfPin, HIGH);
delayMicroseconds(fpulse * 1);
digitalWrite(rfPin, LOW);
delayMicroseconds(fpulse * 15);
// end send SYNC
// Send command
for (int i = 0; i < 28; i++) // Flamingo command is only 28 bits */
{
// read data bit
fdatabit = fsendbuff & fdatamask; // Get most left bit
fsendbuff = (fsendbuff << 1); // Shift left
if (fdatabit != fdatamask)
{ // Write 0
digitalWrite(rfPin, HIGH);
delayMicroseconds(fpulse * 3);
digitalWrite(rfPin, LOW);
delayMicroseconds(fpulse * 1);
}
else
{ // Write 1
digitalWrite(rfPin, HIGH);
delayMicroseconds(fpulse * 1);
digitalWrite(rfPin, LOW);
delayMicroseconds(fpulse * 3);
}
}
}
}
void setup() {
Serial.begin(9600);
}
void loop() {
Flamingo_Send(0, 1, 1);
delay(1000);
Flamingo_Send(0, 1, 0);
delay(3000);
}
Unfortunately, my Flamingos do not react. Do you have any way to determine, based on my information on ELRO Flamingo FA50R Remote Protocol ยท GitHub what I need to change?
Thanks!
probono