ARDUINO 실습 과제 보 고서. PWM 은 아날로그 출력이라는 함수를 사용하게 되는데 이 출력에는 3, 5, 6, 9, 10, 11 번의 핀만 사용 가능. ( 숫자 옆 에 ~ 표시 )

Slides:



Advertisements
Similar presentations
Anurag Dwivedi & Rudra Pratap Suman.  Open Source electronic prototyping platform based on flexible easy to use hardware and software.
Advertisements

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.
ELCT 201 week 13 Analog ON/OFF control system conversion to Digital ON/OFF control system.
South Jersey Robotics Club July 2014 Meeting Presentation Topic –Arduino (cont)
Intro to Programming and Microcontrollers. Activity Group into pairs and sit back-to-back. Pick one person who is going to draw. The other person will.
Finish your programs from last week STOPLIGHT CIRCUIT! You may need … – int – void setup() – void loop() – pinMode – digitalWrite – delay.
ARDUINO 1 By Wilmer Arellano. Arduino  Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software.
Embedded Programming and Robotics Lesson 2 C Programming Refresher C Programming1.
Basic Circuits – Lab 2 Arduino and Sensors Xmedia Spring 2011.
Arduino web site: What is Arduino? Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and.
ARDUINO 1 By Wilmer Arellano (Under Development).
ARDUINO 1 Under Development. Arduino  Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software.
Basic Circuits – Lab 2 Arduino and Sensors
Lecture 9: Microcontrollers – part 1 BJ Furman 29OCT2012.
chipKit Sense Switch & Control LED
ARDUINO 1 Under Development. Arduino  Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software.
Microcontroller Hands-on Workshop #3 Ahmad Manshad New Mexico State University Institute of Electrical and Electronics Engineers November 7, 2009.
ProtoSnap Introduction to Arduino Casey Haskell, Pete Lewis, David Stillman, Jim Lindblom, Pete Dokter, Lindsay Levkoff, Trevor Zylstra.
ARDUINO 1 Under Development. Arduino  Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software.
Cascade switching of an LED EAS 199B Winter 2013.
Pulse Width Modulation (PWM). 100% Pulse Width Modulation (PWM) 0% On the chipKIT there are 490 periods per second. Use analogWrite(pin, value) to control.
Good LED Circuit 5V0 GND. What Voltage Does Meter See? Answer: 5 V.
LECTURE 2 – INPUTS THIS LECTURE WILL INTRODUCE HOW TO INPUT SIGNALS INTO AN ARDUINO.
Programming, Serial and Virtual Prototyping. Code if ( You like semicolons ) { Stay here for intro to Arduino code } else { Join the MODKit group for.
ARDUINO 1. Basics  Comments  /* * Blink * * The basic Arduino example. Turns on an LED on for one second, * then off for one second, and so on... We.
Arduino Circuits and Code. int ledPin = 9; void setup() { pinMode(ledPin, OUTPUT); } void loop() { digitalWrite(ledPin, LOW); delay(1000); digitalWrite(ledPin,
Lecture 10: Peripherals Bryan Burlingame 04 November 2015.
ARDUINO 1 By Wilmer Arellano. Arduino.  Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use.
Autumn, 2012C.-S. Shieh, EC, KUAS, Taiwan1 智慧電子應用設計導論 (1/3) Sensors I Chin-Shiuh Shieh ( 謝欽旭 ) Department of Electronic.
Photoresistor resistance changes dramatically with light level living with the lab Using Photoresistors with an Arduino © 2011 LWTL faculty team.
Motor TYWu.
[Lab10] Output PWM  Output PWM Signal  Example  Exercise(Optional)
Microcontroller basics Embedded systems for mortals.
Microcontroller basics Embedded systems for mortals.
Lecture 9: Introduction to Arduino Topics: Arduino Fundamentals, Bean Date: Mar 22, 2016.
Programming in Arduino Materials:Arduino Board Casperelectronics Pre Pres. Notes Photos from workshop?
LAB1 TYWU. Devices Dip Switch (4 Switches) Triple Output LED (RGB) –Common Cathode.
Arduino DC Motor Motion Control Instructor: Dr Matthew Khin Yi Kyaw.
Arduino + Bluetooth TYWu. Connection Arduino + Bluetooth Module.
Raspberry Pi project - 라즈베리파이로 핑퐁게임하기 신동윤 박지환.
김희승 임승한 IT 인재 양성 Arduino Programming OneScoreSung Han Lim.
Pulse-Width Modulation: Simulating variable DC output
ME 120: Arduino PWM Breathing LED Code: Implementation on Arduino ME 120 Mechanical and Materials Engineering Portland State University
Pulse Width Modulation Instructor Dr Matthew Khi Yi Kyaw.
Arduino Application: Speed control of small DC Motors
physical computing .2 – Day 3
Introduction to Physical Computing
Microcontroller basics
Microcontroller basics
Exploring lighting effects with LED’s and Arduino
Microcontroller basics
Cascade switching of an LED
Get Your Project Started with Arduino
(6. Sunu) (AVR Assembly Örnekleri)
Lab 1: Arduino Basics Topics: Arduino Fundamentals, First Circuit
Въведение в Arduino.
Programming, Serial and Virtual Prototyping
Servos and Stepper Motors
CS-4540 Robotics - Lab 05 Switch inputs to the Arduino Uno
Topics: Programming Constructs: loops & conditionals Digital Input
Arduino : Introduction & Programming
Arduino Practice: Photoresistors, PWM, Potentiometers, Motors
(Dr. Öğr. Üyesi Deniz Dal)
SAURABH GINGADE.
Arduino 1 By Wilmer Arellano.
Arduino程式範例.
Pulse-Width Modulation: Simulating variable DC output
Arduino Programming: “if” statements
Presentation transcript:

ARDUINO 실습 과제 보 고서

PWM 은 아날로그 출력이라는 함수를 사용하게 되는데 이 출력에는 3, 5, 6, 9, 10, 11 번의 핀만 사용 가능. ( 숫자 옆 에 ~ 표시 )

int led = 3; int brightness = 0; int increment = 1; void setup() { } void loop() { if(brightness > 255) { increment = -1; } else if(brightness < 1) { increment = 1; } brightness = brightness + increment; analogWrite(led, brightness); delay(10); } analogWrite 을 통해 구동되는 핀은 출 력으로 선언하지 않아도 된다.

int ledPins[] = {2,3,4,5,6,7,8,9}; void setup() { for(int i=0; i<8; i++) { pinMode(ledPins[i],OUTPUT); } void loop() { for(int i=0; i<8; i++) { digitalWrite(ledPins[i], HIGH); delay(100); } for(int i =7; i>=0; i--) { digitalWrite(ledPins[i], LOW); delay(100); }

QA~QH = 출력 SER = data 핀 (2 번 ) SRCLK = clock 핀 (3 번 ) RCLK = latch 핀 (4 번 ) OE = reset(5V) RSCLR = enable input(GND)

int datapin = 2; int clockpin = 3; int latchpin = 4; byte data = 0; void setup() { pinMode(datapin, OUTPUT); pinMode(clockpin, OUTPUT); pinMode(latchpin, OUTPUT); } void loop() { for(int i = 0; i<=7; i++) { shiftWrite(i,HIGH); delay(100); }

for(int i = 7; i>=0; i--) { shiftWrite(i,LOW); delay(100); } void shiftWrite(int desiredPin, boolean desiredState) { bitWrite(data, desiredPin, desiredState); shiftOut(datapin, clockpin, MSBFIRST, data); digitalWrite(latchpin, HIGH); digitalWrite(latchpin, LOW); }

PWM 을 이용하여 각도 컨트롤

#include Servo motor1; void setup() { motor1.attach(9); } void loop() { for(int position = 0; position<=180; position +=2) { motor1.write(position); delay(20); } for(int position =180; position >=0; position -=2) { motor1.write(position); delay(20); }

스피드를 컨트롤하기 위한 1 개의 PWM 와 방향을 결정하기 위한 디지털 출력 필요.

int speedPin = 3; int motor1APin = 6; int motor2APin = 7; int speed_value_motor1 = 127; void setup() { pinMode(speedPin, OUTPUT); pinMode(motor1APin, OUTPUT); pinMode(motor2APin, OUTPUT); } void loop() { digitalWrite(motor1APin, LOW); digitalWrite(motor2APin, HIGH); analogWrite(speedPin, speed_value_motor1); }

int button1Pin=2; int ledPin=13; void setup() { pinMode(button1Pin, INPUT); pinMode(ledPin, OUTPUT); } void loop() { int button1State; button1State = digitalRead(button1Pin); if (button1State == LOW) { digitalWrite(ledPin, HIGH); } else { digitalWrite(ledPin, LOW); }

뗐을 때 댔을 때

int signal = 4; int onoff; void setup() { Serial.begin(9600); } void loop() { onoff = digitalRead(signal); Serial.println(onoff); }

감사합니다.