|
Intro to Physical Computing Syllabus Research & Learning Other Class pages
ITP Help Pages |
Tom Fall 11 Week 4Intro.TomFall11Week4 HistoryHide minor edits - Show changes to markup September 28, 2011, at 11:40 AM
by -
Added lines 1-23:
(:source lang=arduino :) // put the analog output pins in an array: int pwmPins[] = { 3,5,6,9,10,11}; void setup() { } void loop() { // count from 0 to 5:
for (int thisPin = 0; thisPin < 6; thisPin++) {
// read the analog input corresponding to thisPin:
int sensorValue = analogRead(thisPin);
// write to the analog output pin corresponding to thisPin in the array:
analogWrite(pwmPins[thisPin], sensorValue/4);
}
} (:sourceend:) |