I am designing a system with Arduino Uno for automating a process. I need to control 4 relays and also 2 dimmers. Commands are issued through bluetooth serial for the ON/OFF operation of relays and also for the dimming value. The dimming value changes only once in a while and Arduino needs to maintains the recent dimming level.
I get external interrupt every 10ms (zero crossing at 50Hz) and use this for dimming. Relay and dimming concept works perfectly independently.
Together they have an issue. Arduino is busy executing the interrupt which is triggered at every 10ms. So it is not able to read the serial data received through bluetooth. How can I set precedence for serial data reading over the 10ms interrupt, to ON/OFF the relays as and when required and also to provide a new value for the dimming level?