title: Arduino AC Dimmer - serial communication lost due to interrupt
body: <p>I 've made a pcb for a wireless ac light dimmer which is based on ATMega328p(Arduino Uno), 433 MHZ UART module for wireless communication, a TRIAC for ac load dimming and a MOC3020 for zero crossing detection for the arduino interrupt. Briefly, I have a transmitter which sends commands to the dimmer, the commands are two bytes; the first byte is an ID, the second byte is the dimming level which are 5 levels: 0%,25%,50%,75%,100%. I've programmed it to take about 2 seconds between each level. The serial communication baud rate is 9600 bps. My problem is that when I send a command during dimming time then the serial communication is totally lost. The thing is the Serial port can't read data while the interrupt is occurring. I thought of detaching the interrupt before reading data and reattaching it when its done but it didn't work. I've also tried to read the serial data inside the ISR but it didn't work too. Last thing I thought of is changing the baud rate but I didn't try it yet.</p>
  
  <p>any suggestions to solve this problem.</p>
  
  <p>Thanks</p>