1 /* Pong controller (for use with hPong)
6 int min = 65535, max = 0;
9 float val = 0, oldval = -255;
12 void setup() // run once, when the sketch starts
16 pinMode(sndPin, OUTPUT);
19 void loop() // run over and over again
21 val = analogRead(inpin);
24 val=(((val-(min))/(max-(min)))*stadium_max)-offset;
27 //Serial.print(min, DEC); Serial.print("-"); Serial.print(max, DEC); Serial.print("\n");
28 //Serial.print(val, DEC); Serial.print("\n");
29 //Serial.print(val, BYTE);
32 digitalWrite(sndPin, HIGH);
34 digitalWrite(sndPin, LOW);