Sending RF signal after Serial input

I am trying to reproduce a simple 433mhz signal through an RF transmitter. I have used RCSwitch to capture this signal and when I write a simple “Send” code, it works great - it turns off a light via a wireless outlet. My issue is not really related to this hack.

If I use this code below, my signal comes out correctly.

#include <RCSwitch.h>

RCSwitch mySwitch = RCSwitch();

void setup() {

void loop() {
  mySwitch.send(5526835, 24);

However, when I try to do something more complicated with this code using the serial input, my signal does not work. As far as I can tell, the pulseLength gets set to 350 instead of my required 183.

My code is a little longs, so I will not post, but I am asking for an input from the Serial. A “11” means device 1 ON and a “10” means device 1 OFF. The code seems to work as expected and even gives an output signal, but the pulse length goes back to 350. Is there something going on with an “interrupt” or is the Serial input doing something to my output signal? I have even played around with interrupts but still cannot get this more complicated example to work.