Hardware - Arduino Mega 2560 with 4 relay shield.
Deliverable is the code I upload to the Mega.
ledA,B,C - have Led drivers with pwm input.
relay - has non dimming led driver.
analogWrite to pins to led-drivers has been tested and works well.
Explanation of deliverable:
Arduino code - multitasking Electronic Engineering specialist. code to control 5 buttons.
Momentary button1 (pin17) - upon press, ledA (pin9) turns on for 10000 milliseconds - analogWrite(9, 135);
- if (after 1000ms) button 1 is pressed during 'on' then turn ledA off
Momentary button2 (pin18) - upon press, ledB (pin10) turns on for 11000 milliseconds - analogWrite(10, 135);
- if (after 1000ms) button 2 is pressed during 'on' then turn ledB off
Momentary button3 (pin19) - upon press, ledC (pin11) turns on for 9000 milliseconds - analogWrite(9, 135);
- if (after 1000ms) button 3 is pressed during 'on' then turn ledC off
Momentary button4 (pin20) - upon press, Relay1 (pin4) turns on for 12000 milliseconds - analogWrite(9, 256);
- if (after 1000ms) button 4 is pressed during 'on' then turn Relay1 off
Momentary button5 (pin16) - upon press, ledABC and Relay1 flash on/off for 10000 milliseconds - analogWrite(9, 135);
- if (after 1000ms) button 5 is pressed during 'on' then turn it off
Button 5 turns on above 4 concurrently that hopefully pulse/strobe/blink for 10000 milliseconds
ledABC bright/dim/bright/dim(pwm 135,70,135,70,etc)... Relay1 on/off(pwm256,0,256,0,etc)
Ideally the 4 would be pulsing at different times or durations -
Of note - buttons 1,2,3,4 do not turn each other off. You can press 1 then 2 and they both turn on as specified.
Only button 5 alters 1,2,3,4 current tasks.
IF INTERRUPTS are to be used, we may need to change button pin assignments - no problem.
About the recuiterMember since Sep 3, 2017 Liam Williams
from New Jersey, United States