Home | Projects | Notes > Embedded Systems Design using UML State Machines > Exercise 1: Changing Intensity of an LED

Exercise 1: Changing Intensity of an LED

 

Overview

Requirements

  1. Connect the LED to any one of the PWM pins on the Arduino Uno board.

  2. Modify the duty cycle of the PWM wave using the Arduino API's analogWrite() function.

    • With the Arduino Uno board, the analogWrite() API is not related to internal analog peripherals. Instead, it controls the ON/OFF period through the pin using a timer to achieve the desired duty cycle.

    • Language Reference: https://www.arduino.cc/reference/en/

  3. Utilize the Arduino serial interface to transmit ON and OFF events from the host.

Components

Hardware

 

arduino-uno-board

 

PWM Duty Cycle

 

pwm-duty-cycle

 

Arduino Serial (UART) Communication with Host

 

arduino-serial-communication-with-host

 

 

Implementation - Mealy State Machine

Mealy State Machine

 

mealy-machine-example

 

Implementation

 

Implementation - Moore Machine

Moore State Machine

 

moore-machine-example

 

Implementation