Presentation is loading. Please wait.

Presentation is loading. Please wait.

Embedded Sumo 1T4 – 1T5 UTRA.

Similar presentations


Presentation on theme: "Embedded Sumo 1T4 – 1T5 UTRA."— Presentation transcript:

1 Embedded Sumo 1T4 – 1T5 UTRA

2 What is Arduino? Image Source:

3 Arduino is an open-source electronics platform based on easy-to-use hardware and software. It's intended for anyone making interactive projects. - arduino.cc Image Source:

4 Micro-controller: ATMega328-PU
Image Source:

5 Aruidno IDE C-like programming language One-button upload
Come with example code

6 Setup the IDE Select board Select Port
Port number can be found in “Device Manager” from “Control Panel”

7 Example: Blinking LED /* Blink
Turns on an LED on for one second, then off for one second, repeatedly. Most Arduinos have an on-board LED you can control. On the Uno and Leonardo, it is attached to digital pin 13. If you're unsure what pin the on-board LED is connected to on your Arduino model, check the documentation at This example code is in the public domain. modified 8 May 2014 by Scott Fitzgerald */

8 Example: Blinking LED void setup() { pinMode(13, OUTPUT); }
void loop() { digitalWrite(13, HIGH); delay(1000); digitalWrite(13, LOW);

9 Example: Blinking LED void setup() { … }
This function runs only once after boot-up or after you pressed the reset button. Hence the name “setup”. This function sets pin 13 as “output”, meaning you can set it to either “high” (5V) or “low” (0V). pinMode(13, OUTPUT); void loop() { } This function runs over and over again forever.

10 Example: Blinking LED This command turns the LED on (by making a 5V output). digitalWrite(13, HIGH); delay(1000); Sleep for 1 second. The unit for this function is millisecond (ms) and 1000 ms = 1s. digitalWrite(13, LOW); This command turns the LED off (by making the output 0V, which is the same as ground).

11 Example: Blinking LED void setup() { pinMode(13, OUTPUT); }
void loop() { digitalWrite(13, HIGH); // LED on for 1 second delay(1000); digitalWrite(13, LOW); // LED off for 1 second } // repeat (back to the beginning of loop)

12 Example: Analog & Serial
void setup() { Serial.begin(9600); } void loop() { int sensorValue = analogRead(A0); Serial.println(sensorValue); delay(1000); } // repeat (back to the beginning of loop)

13 Example: Analog & Serial
This command starts the serial communication between Arduino and the host PC at a specific baud rate. In this case, 9600. Serial.begin(9600); analogRead(A0); This command reads the voltage input at A0 and translate the number into a value between 0 and 1023. Serial.println(sensorValue); This command prints the value of the variable to the serial terminal in the Arduino IDE.

14 Serial Terminal Click to open the serial terminal Inputs
(from PC to Arduino) Outputs (from Arduino to PC) Select the correct baud rate


Download ppt "Embedded Sumo 1T4 – 1T5 UTRA."

Similar presentations


Ads by Google