Topics: Analog/Digital Read Relay control 7 segment control Buzzer

Slides:



Advertisements
Similar presentations
ARDUINO CLUB What we’re really doing. BASICS The setup() and loop() functions.
Advertisements

Lab7: Introduction to Arduino
ARDUINO FRAMEWORK.
Anurag Dwivedi & Rudra Pratap Suman.  Open Source electronic prototyping platform based on flexible easy to use hardware and software.
Embedded Sumo 1T4 – 1T5 UTRA.
Re-programming the Simon Says with Arduino Linz Craig, Brian Huang.
Digital & Analog Inputs. Review Fundamental parts of an Arduino program are … Setting output types using pinMode. Declaring variables Can write a digital.
Introduction to Arduino Programming January MER-421:Mechatronic System Design.
Basic Circuits – Lab 2 Arduino and Sensors Xmedia Spring 2011.
ARDUINO PROGRAMMING Working with the Arduino microcontroller.
Arduino Part 2 Topics: Serial Communication Programming Constructs: functions, loops and conditionals Digital Input.
Microprocessors Tutorial 1: Arduino Basics
ProtoSnap Introduction to Arduino Casey Haskell, Pete Lewis, David Stillman, Jim Lindblom, Pete Dokter, Lindsay Levkoff, Trevor Zylstra.
Introduction to the Arduino
Cascade switching of an LED EAS 199B Winter 2013.
LECTURE 2 – INPUTS THIS LECTURE WILL INTRODUCE HOW TO INPUT SIGNALS INTO AN ARDUINO.
Microprocessors Tutorial 1: Arduino Basics
1 - Remove LED from 13 and GND - Bring out your breadboard from HW#4 Arduino Overview:
Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) Getting Started.
Arduino libraries Datatekniker Udvidet hardware/software.
Lecture 9: Introduction to Arduino Topics: Arduino Fundamentals, Bean Date: Mar 22, 2016.
ME 120: Arduino Programming Arduino Programming Part II ME 120 Mechanical and Materials Engineering Portland State University
Arduino + Bluetooth TYWu. Connection Arduino + Bluetooth Module.
Pulse Width Modulation Instructor Dr Matthew Khi Yi Kyaw.
1 Introduction to Coding. 2 Example Codes A lot of example codes are given with Arduino IDE A code can often be based on a previous example rather than.
Hacking on Arduino George Patterson
physical computing .2 – Day 3
Harpeth Hall Jan 2016 Introduction to Arduino Prepared for Harpeth Hall Winterim January 2016.
Having fun with code, using Arduino in a middle school CS classroom
Application of Programming: Scratch & Arduino
Microcontroller basics
Val Manes Department of Math & Computer Science
Microcontroller basics
Wireless Cue Light Project
Microprocessors Tutorial 1: Arduino Basics
Arduino & its hardware interfacing
Arduino Programming Part II
UTA010 : Engineering Design – II
An Arduino Workshop A Microcontroller.
Cascade switching of an LED
Get Your Project Started with Arduino
European Robotic LABoratory
Topics: ArduinoIO package Simulink with arduinoIO
Arduino Part 1 Topics: Microcontrollers Programming Basics
INC 161 , CPE 100 Computer Programming
3.0 ARDUINO WORKSHOP PRESENTATION FOR STUDENTS IN 4º DEGREE OF COMPULSORY SECONDARY EDUCATION 3.0.
Lecture 2-2: Arduino Programming
Arduino.
Control the color and brightness of an RGB LED with a Potentiometer
Arduino Uno and sensors
Control a motors angular position with a flex sensor
Introduction to Arduinos
Roller Coaster Design Project
What is an Arduino ? Open Source electronic prototyping platform based on flexible easy to use hardware and software.
Create a paper craft for any object that makes a sound
Topics: Arduino Target Package
Topics: Programming Constructs: loops & conditionals Digital Input
Chapter 1 Introduction of Arduino
Arduino : Introduction & Programming
Programming 2: The Arduino IDE & First Sketches
Arduino Practice: Photoresistors, PWM, Potentiometers, Motors
Sensors and actuators Sensors Resistive sensors
Making) Melody timer.
Arduino UMBC IEEE Sekar Kulandaivel
Lab #1: Getting Started.
Arduino Uno circuit basics
Introduction to Arduinos
Arduino程式範例.
Arduino UMBC IEEE Sekar Kulandaivel Week 3: Motor Control w/ H-Bridges
Introduction to Arduino IDE and Software
Presentation transcript:

Topics: Analog/Digital Read Relay control 7 segment control Buzzer Arduino Part 2 Topics: Analog/Digital Read Relay control 7 segment control Buzzer

Workshop Overview Hands-on Project 4: Reading analog signal Hands-on Project 5: Reading digital signal Hands-on Project 6: melody with buzzer Hands-on Project 7: LED Dimmer Hands-on Project 8: Relay control Hands-on Project 9: 7-segment control

Hands-on Project 4: Reading analog signal 1 2 hardware setup: Write the code/sketch: void setup() { Serial.begin(9600); } void loop() { int sensorValue = analogRead(A0); Serial.println(sensorValue); delay(1000); Trimmer potentiometer

Hands-on Project 4: Reading analog signal 3 4 Load the program into arduino Open serial monitor, turn the potentiomenter and observe the output Press verify button to check for errors Press upload button to load the program into the arduino Serial monitor Try to use other sensors/input that produce analog signal and observe the output

Hands-on Project 5: Reading digital signal 2 1 Write the code/sketch: hardware setup: int pushButton = 2; void setup() { Serial.begin(9600); pinMode(pushButton, INPUT); } void loop() { int buttonState = digitalRead(pushButton); Serial.println(buttonState); delay(1); 10kOhm

Hands-on Project 5: Reading digital signal 3 4 Load the program into arduino Open serial monitor, press the button and observe the output Press verify button to check for errors Press upload button to load the program into the arduino Serial monitor Try to use other sensors/input that produce digital signal and observe the output

Hands-on Project 6: melody with buzzer 1 2 The code/sketch: hardware setup:

Hands-on Project 6: melody with buzzer 3 4 Once uploaded, you should be able to hear the melody Load the program into arduino Press verify button to check for errors Press upload button to load the program into the arduino Try to change the tone variable and observe the output

Hands-on Project 7: LED Dimmer 1 2 The code/sketch: hardware setup: 220 Ohm

Hands-on Project 7: LED Dimmer 3 4 Once uploaded, you should be able to see the brightness of your LED changes Load the program into arduino Press verify button to check for errors Press upload button to load the program into the arduino

Hands-on Project 8: relay control 1 hardware setup (use relay module from SIRIM robokit): relay2 relay1 relay4 relay3 GND 5v

Hands-on Project 8: relay control 2 The Code: void setup() { Serial.begin(9600); pinMode(12, OUTPUT); } void loop() { if (Serial.available() > 0) { int inByte = Serial.read(); switch (inByte) { case 'a': digitalWrite(12, HIGH); break; case 'b': digitalWrite(12, LOW); Copy from previous example (project3) use pin/port number 12 3 Verify and upload the program 4 Press ‘a’ or ‘b’ to activate the relay

Hands-on Project 9: 7-segment control 1 hardware setup (use 7segment module from SIRIM robokit): 5v GND Bit 1 Bit 0 Bit 3 Bit 2 display4 display3 display2 display1

Hands-on Project 9: 7-segment control 2 The Code: bit3 bit2 bit1 bit0 display 1 2 3 4 5 6 7 8 9 we will use display number 4 only the number will be displayed based on the following table: 5v GND Bit 1 Bit 0 Bit 3 Bit 2

Hands-on Project 9: 7-segment control 2 The Code(cont.): int b0 = 2; int b1 = 3; int b2 = 4; int b3 = 5; int b4 = 6; void setup() { pinMode(b0, OUTPUT); pinMode(b1, OUTPUT); pinMode(b2, OUTPUT); pinMode(b3, OUTPUT); pinMode(b4, OUTPUT); } void loop() { digitalWrite(b0, HIGH); digitalWrite(b1, LOW); digitalWrite(b2, LOW); digitalWrite(b3, LOW); digitalWrite(b4, HIGH); } 5v GND Bit 1 Bit 0 Bit 3 Bit 2 This code will always display number 1. Try to change the number by changing the logic level of b0,b1,b2 and b3 according to the previous table

Hands-on Project 9: 7-segment control 3 The results: void loop() { digitalWrite(b0, HIGH); digitalWrite(b1, LOW); digitalWrite(b2, LOW); digitalWrite(b3, LOW); digitalWrite(b4, HIGH); } void loop() { digitalWrite(b0, LOW); digitalWrite(b1, HIGH); digitalWrite(b2, LOW); digitalWrite(b3, LOW); digitalWrite(b4, HIGH); } void loop() { digitalWrite(b0, HIGH); digitalWrite(b1, HIGH); digitalWrite(b2, LOW); digitalWrite(b3, LOW); digitalWrite(b4, HIGH); }

References www.arduino.cc www.ladyada.net/learn/arduino www.EarthshineElectronics.com https://learn.sparkfun.com/