Test Example: LED Blink on Arduino Uno-R3
Introduction
CASP supports deploying models on micro-controller boards. This example project develops a model to blink on-board LED of Arduino Uno-R3 board. This project can be used to validate whether board support package (BSP) for the target board is properly installed.
Prerequisites
· Arduino Uno-R3 board along with a USB cable.
· Arduino BSP should be installed before running this project.
Model Details
· GPIO block is configured to use pin-13 (LED pin) as digital output.
· Logic-1: Square wave generator block connected to the above GPIO block to blink LED.

· Logic-2: A signal generator block is connected to the above LED GPIO block. It is configured to generate a square wave output whose frequency is variable form external signal. The external frequency control pin of this block is driven from another GPIO block configured as ADC input from pin-A0. The idea is to make a logic such that the LED blink frequency is varied based on the voltage applied to the ADC pin.

· Enable only one of the above two logics at any given time to avoid build errors.
How to run the project
· Ensure the micro-controller board is connected to the computer through USB serial.
· Start CASP and open the project.
· Set
serial port to which the board is connected in ‘Setup Simulation’ parameters.
For this, click ‘Setup Simulation’ icon
and from the dialog
box that appears set the serial port as shown in below figure.

· Enable square wave generator block in green rectangle section (see figure in Model Details section above) and disable all blocks inside blue rectangle section.
· Click the Start button to build the model and program the board. The on-board LED should now blink at constant frequency.
· Now, disable the blocks inside green rectangle section and enable all blocks inside blue section.
· Click the Start button to build the modified model and program the board again. Apply a sample voltage between 0 to 5V at ADC pin-A0 and observe the change in LED blink frequency accordingly.