Embedded Systems Activity 1 Digital I/O PDF 2024

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Summary

This document details an activity on digital I/O for an embedded systems course. It includes a circuit diagram and code examples for making an LED blink every second using Arduino.

Full Transcript

Activity 1: Digital I/O Embedded Systems - Julian Barreiro-Gomez Fall - 2024 Brief Description: Use the digital output 13 to make an LED blink every second. Figure 1: Circuit scheme 1 // Embedded Systems // Augus...

Activity 1: Digital I/O Embedded Systems - Julian Barreiro-Gomez Fall - 2024 Brief Description: Use the digital output 13 to make an LED blink every second. Figure 1: Circuit scheme 1 // Embedded Systems // August 2024 3 // Toy Problem Example 5 const int pause = 1000; // we define a integer constant for the delay. // We create "pause" to easily change the delays in a single line 7 const int pin = 13; // we define a integer constant for the digital output pin // We create "pin" to easily change the output pin if needed 9 void setup() { 11 // This is executed only once, this function is used for setup only pinMode(pin,OUTPUT);// this is to set "pin" (13) as an output 13 } 15 void loop() { 17 // This is executed, and it is within a loop digitalWrite(pin,HIGH); // this is to set "pin" (13) to high level 19 delay(pause); // delay function is defined in miliseconds digitalWrite(pin,LOW); // this is to set "pin" (13) to low level 21 delay(pause); // delay of 1000 miliseconds } Listing 1: First simple code Khalifa University - Embedded Systems Page 1

Use Quizgecko on...
Browser
Browser