Day 1: (Aug 27) Welcome and Arduino Introduction
Notes for 2018-08-27.  See also the Fall 2018 Calendar.
Agenda
- Welcome.
- What is IDeATe?
- What is Physical Computing?
- Why did the course change name?
- Project focus: Pittsburgh Children’s Museum
- Unspoken prerequisites.
 
- Administrative
- Enrollment and waitlist.
- Resources.
- Card access.
- Physical Computing Lab use and abuse.
- We are sharing the room with four other classes (see IDeATe PhysComp Lab Calendar).
- Office hours: tentatively Wed 11:30-1:30 in the lab.
- IDeATe Computing Virtual Cluster.
 
 
- Assignments
- In-class
- Brief introduction to the Arduino (in 16-223 slides Drive folder)
- Each person pick up an Arduino, USB cable, cluster laptop, breadboard, speaker, IRF540, and a few jumper wires.
- Crash course in Arduino basics.
- Write an Arduino sketch to play tones in sequence to create a siren. For now, it is easiest to use tone()anddelay()insideloop().
- Related exercises: Exercise: Arduino Introduction, Exercise: Coding, Compiling, Deploying, Exercise: Unipolar Drivers
- If time permits: rewrite your sketch without using delay(), then add a simultaneous fast-blink on the LED. For ideas, see Exercise: Event-Loop Programming
- At the end of class, please return the Arduinos and other components.
 
 
Lecture code samples
|  1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16 | // generate tones on a speaker on pin 5
void setup()
{
  tone(5, 440);
}
void loop()
{
  delay(1000);
  noTone(5);
  delay(1000);
  tone(5, 660);
  delay(1000);
  tone(5, 440);
}
 | 
|  | void setup()
{ 
  pinMode(5, OUTPUT);
}
void loop()
{
  long now = micros();
  bool square1 = (now % 2274) < 1136;
  bool square2 = (now % 1516) < 758;
  digitalWrite(5, square1 ^ square2);
}
 |