mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-20 21:01:25 +03:00
This commit is contained in:
@ -31,10 +31,6 @@
|
|||||||
see also http://www.tigoe.net/pcomp/code/category/arduinowiring/514 for more
|
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:
|
// 2-dimensional array of row pin numbers:
|
||||||
const int row[8] = {
|
const int row[8] = {
|
||||||
@ -85,8 +81,10 @@ void readSensors() {
|
|||||||
// turn off the last position:
|
// turn off the last position:
|
||||||
pixels[x][y] = HIGH;
|
pixels[x][y] = HIGH;
|
||||||
// read the sensors for X and Y values:
|
// read the sensors for X and Y values:
|
||||||
x = 7 - map(analogRead(0), sensorMin, sensorMax, 0, 7);
|
x = 7 - map(analogRead(0), 0, 1023, 0, 7);
|
||||||
y = map(analogRead(1), sensorMin, sensorMax, 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;
|
pixels[x][y] = LOW;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -112,4 +110,3 @@ void refreshScreen() {
|
|||||||
digitalWrite(row[thisRow], LOW);
|
digitalWrite(row[thisRow], LOW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user