ARDUINO RoboTek ARDUINO practices students' real-life problem solving through constructing do-it-yourself projects. Through these projects, students understand the application and benefits of doing robotics in different fields. is an open-source hardware and software company, ARDUINO ARDUINO project, and user community that designs and manufactures single-board microcontrollers and microcontroller kits for building digital devices. ARDUINO UNO is a small, programmable board that lets you control and connect electronic components. With input and output pins, it enables you to write code that brings physical projects to life, making it a popular tool for learning electronics and programming. Input Process Output INPUT it receives signals from the environment to enable user interaction. The Information or signals that are received by a system are referred to as “input”. Input Process Output With the help of OUTPUT components, users can display data, generate sound, direct movement, and add lighting effects to their creations. The term "output" describes the data or signals produced by a system and transmitted to the outside world. Types of Components Digital – The information is recorded using a finite number of different states, commonly two: high and low, or 1 and 0. Analog - The information included in continuous analog signals or data varies within a range of values. Parts of Arduino Uno board Commonly used functions in programming Arduino Uno board Read – describes the process of obtaining data from a source, such as a network connection, user input, sensor, or file. Write – It is referred to as this to save or output data to a destination, such as a file, a display, a network connection, or a database. digitalWrite() - Using this function, a microcontroller's digital pins can have their states changed. The pin number and the status (HIGH or LOW) are the two arguments that are required. digitalRead() - This microcontroller function is used to read the status of a digital pin. The pin number to be read is the only argument needed. analogWrite() - To create a Pulse Width Modulation (PWM) signal on a digital pin. The pin number and the analog output value are its two required arguments. analogRead() - Using this function, a microcontroller's analog pin can be read for its value. The analog pin number to be read is the only argument required. pinMode- function in Arduino is like telling the board if a certain pin should listen (INPUT) or talk (OUTPUT). It helps set up how each pin behaves, allowing you to connect and control different things like sensors or lights. Software IDE Basic Structure of an Arduino Sketch void setup() { } void loop() { } void setup() { Program runs once } void loop() { Program runs repeatedly } void setup() { statements; } void loop() { statements; } A Breadboard is used to create and test circuits without soldering. It is made out of a grid of joined metal clips that make it simple to insert and connect electronic parts. Parts of a Breadboard Light-Emitting Diode (Digital) Light-Emitting Diode A semiconductor diode that converts electric energy into electromagnetic radiation at a visible and near infrared frequencies when its pn junction is forward biased. 1 – Short pin to be connected to GND (ground) 2 – Longer pin to be connected to any of the digital pins (pins 2 – 13 Resistors Resistance, it blocks the flow of electricity. If the resistance value is big, it flows a little of electricity If the resistance value is small, it flows a lot of electricity Sample Sample Wiring Wiring Diagram Diagram void setup() { pinMode(13, OUTPUT); } void loop() { digitalWrite(13, HIGH); } Variables Variables variable is a named storage location that holds a value, which can be changed during the execution of a program Data Data Types Types Data Types Description Integer Variables (int): Used for storing whole numbers (integers). Example: int myNumber = 10; Character Variables (char): Used for storing single characters. Example: char myChar = 'A'; Boolean Variables (bool): Used for storing true or false values. Example: bool isTrue = true; String Variables (string): Used for storing sequences of characters (text). Requires the inclusion of the <string> header. Example: #include <string> and then string myString = "Hello"; int LED = 2; void setup( ) { // put your setup code here, to run once: pinMode(LED, OUTPUT); } void loop( ) { // put your main code here, to run repeatedly: digitalWrite(LED, HIGH); delay(3000); digitalWrite(LED, LOW); delay(2000); } 31 Serial Monitor Serial Monitor is used to interact with your Arduino board via the serial port of your computer. It offers a straightforward text-based interface for data transmission and reception between the computer and the Arduino. void setup() { Serial.begin(9600); } void loop() { Serial.println("Hello, World!"); delay(1000); } Conditional Statement conditional statements are used to make decisions in a program based on certain conditions. If-Else Condition If Statement: Syntax: if (condition) { // code to be executed if the condition is true } Executes a block of code if the specified condition is true. Else Statement: Syntax: else { // code to be executed if the preceding if condition is false } Executes a block of code if the preceding if condition is false. Else-If Statement: Syntax: if (condition1) { // code to be executed if condition1 is true } else if (condition2) { // code to be executed if condition2 is true } else { // code to be executed if none of the conditions is true } Allows testing multiple conditions sequentially. If (condition) { statements; } else { statements; } 7-Segment Display 7-Segment Display SSD or seven-segment indicator, is a form of electronic display device for displaying decimal numerals that is an alternative to the more complex dot matrix displays. 7-Segment Display Wiring Hands-on Hands-on Activity Activity 8: 8: Build a circuit to display numbers on the 7-segment display from 0 to 9. Each number should be displayed for a short period of time before moving on to the next. int pinA = 2; int pinB = 3; int pinC = 4; int pinD = 5; int pinE = 6; int pinF = 7; int pinG = 8; void setup() { pinMode (pinA,OUTPUT); pinMode (pinB,OUTPUT); pinMode (pinC,OUTPUT); pinMode (pinD,OUTPUT); pinMode (pinE,OUTPUT); pinMode (pinF,OUTPUT); pinMode (pinG,OUTPUT); } void loop() { //0 digitalWrite (pinA, LOW); digitalWrite (pinB, LOW); digitalWrite (pinC, LOW); digitalWrite (pinD, LOW); digitalWrite (pinE, LOW); digitalWrite (pinF, LOW); digitalWrite (pinG, HIGH); delay(1000); } Problem-Based Problem-Based Activity: Activity: Scenario 4: Imagine you've been requested to design a control system for a smart traffic light using an Arduino board, a seven segment display, and three LEDs (representing Red, Yellow, and Green signals). Design a smart traffic light system using Arduino, integrating a 7-segment display to enhance visibility and convey real-time countdown information to pedestrians and drivers. Problem Statement: The objective is to create an efficient traffic control system that dynamically adjusts signal durations based on the traffic density at a junction. The 7-segment display should show a countdown for each signal phase, allowing users to anticipate signal changes for safer and smoother traffic flow.