Hi, Everyone
I am new to Arduino, playing around with the basic examples. but starting to get a bit more ambitious ![]()
I've recently started with a project involving multiple led's (not a matrix or a cube) . Most examples I've seen, involve making led's blink or light up in some or other pattern of sorts, not much involving multiple led's controlled by multiple input values from multiple sensors.
Now, I've looked at State Machines, Switch Case examples, even RTOS's like FreeRTOS, etc...
Most only to show the same effects or outcomes as mentioned above.
I don't have a sketch for this....
So I need help with my Project as follows: -
Setup:
- Using an Arduino Uno
- 16 x Led's, using the Digital Pins 3 to 13 & Analogue Pins A1 to A5. All as OUTPUTS
- On Digital Pin 2, I want to use as an INPUT to measure Rpm
- On Analogue A0, I want to measure and monitor Voltage
The Plan:
The following is required to happen:-
Step 1.
Based on a specified rpm values:=
Example:
*At 20 rpm, switch ON specific led's ON (Led's 1 , 2, 12 = ON)
*At 100 rpm, switch ON more led's AND switch OFF others (Led's 3, 5, 6 = ON; 1, 2 = OFF)
*At 300 rpm, switch ON more led's AND switch OFF others (Led's 7, 10, 11 = ON; 5, 6 = OFF)
The led's that were switched ON must remain ON until the Max rpm is reached.(Max = 500 rpm)
This cycle must NOT be repeated again.
Step 2:
*At 500 rpm, led 12 must be switched OFF, but switched back ON at 400 rpm. This must infinitely continue. (Led 12 must be switched ON at min 400 rpm & OFF at max 500 rpm)
Step 3:
This part must be based on Voltage Values (Max = 36 volts, Min = 33 volt)
*At Default state = Max 36 volt, switch ON specific led's ON (Led's 8, 9 = ON; 2, 5 = OFF) )
*IF voltage = Min 33 volt, start the following sequence:-
1) Led's 3, 5, 6 = ON; 1, 2 = OFF for 60 seconds (60000 milliseconds), then next
2) Led's 7, 10, 11 = ON; 5, 6 = OFF for 60 seconds (60000 milliseconds), then next
3) Led's 3, 13, 14, 15 = ON; 7, 10 = OFF for 60 seconds (60000 milliseconds), then next
4) Return to Default state to check if Voltage = Max 36 volt, then to repeat cycle until Max voltage = 36 volt.
This process/cycle then only repeats when Min = 33 volt is reached.
THIS MUST ALL be happening virtually at the same time (Multitasking)
I'm not sure which would be better: - Switch Case, State Machine or RTOS to accomplish the above? or How to make this work?
Any help in this matter would be much appreciated!
Kind Regards
Erwin
