mirror of https://github.com/noisymime/Arduino.git
This commit is contained in:
parent
d58a4f8d8e
commit
45918cf5ae
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue