Sunday, December 13, 2020

LED Blinking using Arduino and Matlab - Software Loading into Arduino and Demo

 In previous post we have seen the steps to create the Simulink model for the LED Blinking. In this post we will learn about configuring and preparing the model for code generation and deployment to the Arduino board.

Steps for preparing the Simulink model for deployment to Arduino

 The following steps help you to prepare the model for the deployment to the hardware in our case Arduino board.

  • Open the model configuration parameters from the Simulation window or select the little triangle icon beside gear icon in the tool bar and select "Model Configuration Parameters"
  • Select the "Hardware Implementation" option from the right options pane
  • Next choose the "Hardware board" from the drop down list available in our case we will select the Arduino. It can be either Arduino UNO or Arduino Mega 2560 based on your board.
  • Click save for the model configuration parameters.
  • Select the C/C++ Code from the Code menu and then click on Deploy to Hardware option or you can simply press Ctrl+B to deploy the software to the hardware board.
  • After successful code generation the code generation report will be opened automatically and you can browse the code from the simple HTML window popped up. 
  • MATLAB automatically generated the hex file for the Arduino board and deploys it using the connected USB cable.

All the above listed steps are explained in the following video.


 Schematic

 The Arduino schematic is developed using Fritzing software and is as follows, Arduino digital pin 9 is connected to the anode of the LED and the cathode of the LED is connected to the ground via current limiting resistor.

LED Blinking Demo using Arduino

You can check the following video for the LED Blinking demo, as you can see in the video the LED blinks with 0.5sec cycle.


 I hope you enjoyed the LED Blinking project using Arduino, Simulink and Stateflow.

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