//MagicBox9 worked for the right & left linear pot to control 5 movies through Isadora //adjusted for exponential pot #s w a little space between int potPinR = 0; // Analog input pin for linear pot int potPinL = 1; // Analog input pin for linear pot int potValueR = 0; // value read from the pot int potValueL = 0; // value read from the pot int ledL = 9; // PWM pin that the LED is on. n.b. PWM 0 is on digital pin 9 int ledR = 10; int previousStateR = 0; int previousStateL = 0; void setup() { // initialize serial communications at 9600 bps: Serial.begin(9600); } void loop() { //all stuff for left movie selector potValueL = analogRead(potPinL); // read the pot value analogWrite(ledL, potValueL/4); //LED shows state of linear pot if (potValueL > 780 && potValueL < 820 && previousStateL!=0) { Serial.print("D"); // Daguerreotype movie previousStateL = 0; } if(potValueL > 520 && potValueL < 560 && previousStateL!=1){ Serial.print("C"); // Torrini Movie previousStateL = 1; } if(potValueL > 260 && potValueL < 300 && previousStateL!=2){ Serial.print("B"); //Let's Go to the Movies previousStateL = 2; } if(potValueL > 0 && potValueL < 40 & previousStateL!=3){ Serial.print("A"); // Giovanna's Ghost previousStateL = 3; } if(potValueL > 825 && potValueL < 1023 & previousStateL!=4){ Serial.print("S"); previousStateL = 4; } if(potValueL > 565 && potValueL < 775 & previousStateL!=4){ Serial.print("S"); previousStateL = 4; } if(potValueL > 305 && potValueL < 515 & previousStateL!=4){ Serial.print("S"); previousStateL = 4; } if(potValueL > 45 && potValueL < 255 & previousStateL!=4){ Serial.print("S"); previousStateL = 4; } Serial.print('\t'); //all stuff for the right movie selector potValueR = analogRead(potPinR); // read the pot value analogWrite(ledR, potValueR); if (potValueR > 780 && potValueR < 820 && previousStateR!= 5) { Serial.print("H"); // Daguerreotype movie previousStateR = 5; } if(potValueR > 520 && potValueR < 560 && previousStateR!= 6){ Serial.print("G"); //Torrini movie previousStateR = 6; } if(potValueR > 260 && potValueR < 300 && previousStateR!= 7){ Serial.print("F"); // Let's Go to the Movies previousStateR = 7; } if(potValueR > 0 && potValueR < 40 && previousStateR!= 8){ Serial.print("E"); //Giovanna's Ghost previousStateR = 8; } if(potValueR > 45 && potValueR < 255 && previousStateR!= 9){ Serial.print("M"); //smoke movie previousStateR = 9; } if(potValueR > 305 && potValueR < 515 && previousStateR!= 9){ Serial.print("M"); previousStateR = 9; } if(potValueR > 565 && potValueR < 775 && previousStateR!= 9){ Serial.print("M"); previousStateR = 9; } if(potValueR > 825 && potValueR < 1023 && previousStateR!= 9){ Serial.print("M"); previousStateR = 9; } Serial.print('\r'); delay(10); // wait 10 milliseconds before the next loop }