diff options
author | Cristian Maglie <c.maglie@bug.st> | 2013-08-08 16:43:19 +0200 |
---|---|---|
committer | Cristian Maglie <c.maglie@bug.st> | 2013-08-08 16:43:19 +0200 |
commit | a8193ed933d9c9954cefbfb541cde56770ab5b74 (patch) | |
tree | 80796833fecca5d7426f1d09f7ac9870bab5f062 /libraries/TFT/examples/Esplora/EsploraTFTEtchASketch/EsploraTFTEtchASketch.ino | |
parent | a4c9fee673342304a5b12f7f2f7f9ecb9cb26d30 (diff) | |
parent | 5527c44aa443b20d63cf7a276180a36695233924 (diff) |
Merge branch 'ide-1.5.x-library-to-new-format' into ide-1.5.x
Diffstat (limited to 'libraries/TFT/examples/Esplora/EsploraTFTEtchASketch/EsploraTFTEtchASketch.ino')
-rw-r--r-- | libraries/TFT/examples/Esplora/EsploraTFTEtchASketch/EsploraTFTEtchASketch.ino | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/libraries/TFT/examples/Esplora/EsploraTFTEtchASketch/EsploraTFTEtchASketch.ino b/libraries/TFT/examples/Esplora/EsploraTFTEtchASketch/EsploraTFTEtchASketch.ino deleted file mode 100644 index a1430d3..0000000 --- a/libraries/TFT/examples/Esplora/EsploraTFTEtchASketch/EsploraTFTEtchASketch.ino +++ /dev/null @@ -1,83 +0,0 @@ -/* - - Esplora TFT EtchASketch - - This example for the Arduino TFT and Esplora draws - a white line on the screen, based on the position - of the joystick. To clear the screen, shake the - Esplora, using the values from the accelerometer. - - This example code is in the public domain. - - Created 15 April 2013 by Scott Fitzgerald - - http://arduino.cc/en/Tutorial/EsploraTFTEtchASketch - - */ - -#include <Esplora.h> -#include <TFT.h> // Arduino LCD library -#include <SPI.h> - -// initial position of the cursor -int xPos = EsploraTFT.width()/2; -int yPos = EsploraTFT.height()/2; - -void setup() { - // initialize the display - EsploraTFT.begin(); - - // clear the background - EsploraTFT.background(0,0,0); -} - -void loop() -{ - - int xAxis = Esplora.readJoystickX(); // read the X axis - int yAxis = Esplora.readJoystickY(); // read the Y axis - - // update the position of the line - // depending on the position of the joystick - if (xAxis<10 && xAxis>-10){ - xPos=xPos; - } - else{ - xPos = xPos + (map(xAxis, -512, 512, 2, -2)); - } - if (yAxis<10 && yAxis>-10){ - yAxis=yAxis; - } - else{ - yPos = yPos + (map(yAxis, -512, 512, -2, 2)); - } - -// don't let the point go past the screen edges - if(xPos > 159){ - (xPos = 159); - } - - if(xPos < 0){ - (xPos = 0); - } - if(yPos > 127){ - (yPos = 127); - } - - if(yPos < 0){ - (yPos = 0); - } - - // draw the point - EsploraTFT.stroke(255,255,255); - EsploraTFT.point(xPos,yPos); - - // check the accelerometer values and clear - // the screen if it is being shaken - if(abs(Esplora.readAccelerometer(X_AXIS))>200 || abs(Esplora.readAccelerometer(Y_AXIS))>200){ - EsploraTFT.background(0,0,0); - } - - delay(33); -} - |