Saturday, December 19, 2020

LEDs Sequential lighting - Software creation using Simulink and Stateflow for Arduino

 In the previous article we have seen how to blink the single LED using Arduino and the software is developed using Simulink and Stateflow charts. In this article we learn about how to light three different LEDs in sequential manner. 

Required components

  • Three LEDs (Red, Green, Yellow)
  • Arduino
  • Connecting Wires
  • Three Resistors
  • Matlab or Arduino IDE

The idea is to turn only one LED at any time. The sequence is Green LED turns on first and then Yellow LED and finally Red LED and this sequence continues. Green LED will be on for 2 seconds, Yellow LED for 1 second and Red LED for 2 seconds.

Software creation for Arduino using Stateflow

All this is implemented as a stateflow and temporal logic as a transition condition. In earlier article we just used entry condition in the state and this article introduces one more condition called exit condition.

The details of creating the stateflow chart for sequential control of three LEDs is explained in the following video.


 In our next article we will deploy the code generated from the model to the Arduino board and test our logic on the actual hardware.

No comments:

Post a Comment

Reading Potentiometer value using Arduino - Software creation using Ardino IDE and C Programming Language

 In previous article we have seen the steps in creating the software for the reading Potentiometer value using Simulink for Arduino board. ...