Building
Gadgets:
anĀ Open
Electronics
Lab

Fall 2012
course
navigation

Sep 24

1. Discuss homework. Do show'n'tell with an example consisting of
1a. Arduino language reference
2. Explain / demo other components in the lab kit
3. Assign midterm projects
4. Looking ahead
Aside :

/* * square.ino * * generate a sqaure wave of a given frequency. * * Jim Mahoney | Sep 2012 | MIT License */ int wavePin; int waveLevel; // HIGH or LOW float freqHz; // of square wave int halfCycleDelayMicroseconds; int flip(int x){ // if x is HIGH, return LOW, and vice versa. if (x == HIGH){ return LOW; } else { return HIGH; } } void setup() { wavePin = 13; waveLevel = HIGH; freqHz = 50.0; halfCycleDelayMicroseconds = int(1e6 * 0.5 / freqHz); pinMode(wavePin, OUTPUT); } void loop() { digitalWrite(wavePin, waveLevel); waveLevel = flip(waveLevel); delayMicroseconds(halfCycleDelayMicroseconds); }
http://cs.marlboro.edu/ courses/ fall2012/gadgets/ notes/ Sep_24
last modified Thursday September 27 2012 12:09 am EDT