This commit is contained in:
Tom Igoe 2009-06-30 15:15:48 +00:00
parent d58a4f8d8e
commit 45918cf5ae
1 changed files with 10 additions and 13 deletions

View File

@ -31,10 +31,6 @@
see also http://www.tigoe.net/pcomp/code/category/arduinowiring/514 for more
*/
// max and min values from the accelerometer,
// found by experiment:
const int sensorMin = 380;
const int sensorMax = 620;
// 2-dimensional array of row pin numbers:
const int row[8] = {
@ -85,8 +81,10 @@ void readSensors() {
// turn off the last position:
pixels[x][y] = HIGH;
// read the sensors for X and Y values:
x = 7 - map(analogRead(0), sensorMin, sensorMax, 0, 7);
y = map(analogRead(1), sensorMin, sensorMax, 0, 7);
x = 7 - map(analogRead(0), 0, 1023, 0, 7);
y = map(analogRead(1), 0, 1023, 0, 7);
// set the new pixel position low so that the LED will turn on
// in the next screen refresh:
pixels[x][y] = LOW;
}
@ -112,4 +110,3 @@ void refreshScreen() {
digitalWrite(row[thisRow], LOW);
}
}