I've hooked up an arduino Leonardo to an Ikea Fyrtur shade by using its internal uart on the PCB. This allows me to read all the commands being sent to the motor.
For this I'm using the following code. The reading works fine, I see the commands coming in, for example I see same command
when i press the up button. This is the same format and command which is mentioned on this github:
unsigned long target_time = 0L ;
unsigned long PERIOD (10*1000L);
const uint8_t upCommand[] = {0x00, 0xff, 0x9a, 0x0a, 0xdd, 0xd7};
void setup()
{
Serial.begin(9600); //This pipes to the serial monitor
while(!Serial);
Serial1.begin(2400); //This is the UART, pipes to sensors attached to board
while(!Serial1);
}
void loop()
{
if ((millis() - target_time) >= PERIOD)
{
target_time += PERIOD ; // change scheduled time exactly, no slippage will happen
delay(1000);
Serial1.write(upCommand, sizeof(upCommand));
Serial.println("Sending up command");
delay(1000);
}
if( Serial1.available() )
{
int inByte = Serial1.read();
Serial.println( inByte, HEX );
}
}
I'm now trying to replay that same command to the uart, by doing a Serial1.write(byteArray, size). Unfortunately, this does not work. I'm sending the same collection of bytes as what I receive when physically pushing the up button, but when sending it with Serial1.write it does not react to it. Does anybody see what i'm doing wrong here?

