Friday, December 11, 2020

LED Blinking using Arduino and Matlab - Software Creation using Stateflow and Simulink

 In this article we will work on LED blinking program using Arduino. The software required for the LED blinking is developed using MATLAB/Simulink and Stateflow charts. 

The required components

  • One LED
  • Arduino
  • Connecting Wires
  • Resistor
  • Matlab or Arduino IDE

In this article we will use the MATLAB, Simulink and Stateflow to create the required software to blink the LED. In next article we will explore the same using Arduino IDE and C programming language.

Matlab has support for Arduino development and we can use the blocks from  "Simulink Support Package for Arduino". You can follow the below Matlab support article to get the blocks for Arduino

https://in.mathworks.com/hardware-support/arduino-simulink.html

Steps for creating the Simulink model for LED blinking

  • Create an empty model
  • Open the Simulink Library browser
  • Drag and Drop the Digital Output block from "Simulink Support Package for Arduino Hardware"
  • Drag and Drop the Stateflow chart to the model
  • The following video shows the step by step process


     
  •  Now we have seen how to create the software using Simulink and Stateflow and the next step is preparing the Simulink model for the code generation.
  • In our next post we will see how to prepare our LED blinking model for the embedded code generation and how to load the generated executable into Arduino Board.

Stateflow

  • Stateflow is MATLAB is used to create the state machines.
  • In above video we have seen how to use state and entry criteria to control the LED on and off.
  • entry condition in the Stateflow is used to set the state of the signals at start of the state and they will stay remained at the assigned values.

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. ...