Download presentation
Presentation is loading. Please wait.
1
Get Your Project Started with Arduino
Class 3: Arduino and Physical Computing June 11, 2014 Don Wilcher
2
Arduino and Physical Computing
Topics What is Physical Computing? Make: Basic Arduino Book example Let’s Make a Tilt Sensing Servo Motor Controller!
3
What is Physical Computing?
Definitions “The interaction between a human, an electronic circuit, and a sensor is physical computing.” [1] “Physical computing is about creating a conversation between the physical world and virtual world of the computer.” [2]
4
What is Physical Computing?...
References [1] Learn Electronics with Arduino, Wilcher, D., Apress, 2012 [2] Physical Computing, Sullivan, D, and Igoe, T., Thomson Course Technology, 2004
5
Make:Basic Arduino book example
6
Let’s Build a Tilt Sensing Motor Controller
Chapter 3. Tilt Sensing Servo Motor Controller In this chapter, we’ll build a gadget to easily detect object orientation using a tilt control switch to control a servo motor.
7
Tilt Sensing Motor Controller Block Diagram
8
Tilt Sensing Motor Controller Prototype
9
Tilt Sensing Motor Controller BOM
Parts List Arduino microcontroller SW1: tilt control switch JI: servo motor R1: 1K ohm resistor (brown, black, red stripes) Pair of alligator test leads or equivalent Full-size clear breadboard
10
Tilt Sensing Motor Controller Fritzing Wiring Diagram
11
Tilt Sensing Motor Controller Circuit Schematic Diagram
12
Tilt Sensing Motor Controller Sketch
/* This sketch controls a servo motor using a tilt control switch! * * 12 December 2012 * by Don Wilcher */ #include<Servo.h> // include Servo library int inPin = 2; // the tilt control switch is wired to Arduino D2 pin int reading; // the current reading from the input pin Servo myservo; // create servo motor object void setup() { myservo.attach(9); // attach servo motor to pin 9 of Arduino pinMode(inPin, INPUT); // make pin 2 an input } void loop() reading = digitalRead(inPin); // store digital data in variable if(reading == HIGH) { // check digital data with target value myservo.write(180); // if digital data equals target value, // servo motor rotates 180 degrees delay(15); // wait 15ms for rotation else { // if reading is not equal to target value, myservo.write(0); // rotate servo motor to 0 degrees delay(15); // wait 15ms for rotation
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.