|
Intro to Physical Computing Syllabus Research & Learning Other Class pages
ITP Help Pages |
Tom Fall 11 Week 4
// 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); } } |