/* * Potentiometer * * Example created for ME102LAB2. It blinks all LED's connected * to the output of the DM7414 and dims them according to input from a * potentiometer. Output signals are sent out on * pins 11, 10, 9, 7, and 6. * */ int pwmPins[] = {11, 10, 9, 7, 6}; int potPin = 5; int val = 0 ; void setup() // run once, when the sketch starts { for (int i = 0; i<=4; i++){ pinMode (pwmPins[i], OUTPUT); } } void loop() // run over and over again { val = analogRead(5); val = map(val, 1, 1022, 0, 255); for (int i = 0; i<=4; i++){ analogWrite(pwmPins[i], val); }; }