aboutsummaryrefslogtreecommitdiff
path: root/libraries/TFT/examples/Esplora/EsploraTFTHorizon
diff options
context:
space:
mode:
authorCristian Maglie <c.maglie@bug.st>2013-08-08 16:43:19 +0200
committerCristian Maglie <c.maglie@bug.st>2013-08-08 16:43:19 +0200
commita8193ed933d9c9954cefbfb541cde56770ab5b74 (patch)
tree80796833fecca5d7426f1d09f7ac9870bab5f062 /libraries/TFT/examples/Esplora/EsploraTFTHorizon
parenta4c9fee673342304a5b12f7f2f7f9ecb9cb26d30 (diff)
parent5527c44aa443b20d63cf7a276180a36695233924 (diff)
Merge branch 'ide-1.5.x-library-to-new-format' into ide-1.5.x
Diffstat (limited to 'libraries/TFT/examples/Esplora/EsploraTFTHorizon')
-rw-r--r--libraries/TFT/examples/Esplora/EsploraTFTHorizon/EsploraTFTHorizon.ino63
1 files changed, 0 insertions, 63 deletions
diff --git a/libraries/TFT/examples/Esplora/EsploraTFTHorizon/EsploraTFTHorizon.ino b/libraries/TFT/examples/Esplora/EsploraTFTHorizon/EsploraTFTHorizon.ino
deleted file mode 100644
index a7945c9..0000000
--- a/libraries/TFT/examples/Esplora/EsploraTFTHorizon/EsploraTFTHorizon.ino
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
-
- Esplora TFT Horizon
-
- This example for the Arduino TFT and Esplora draws
- a line on the screen that stays level with the ground
- as you tile the Esplora side to side
-
- This example code is in the public domain.
-
- Created 15 April 2013 by Scott Fitzgerald
-
- http://arduino.cc/en/Tutorial/EsploraTFTHorizon
-
- */
-
-#include <Esplora.h>
-#include <TFT.h> // Arduino LCD library
-#include <SPI.h>
-
-// horizontal start and end positions
-int yStart = EsploraTFT.height()/2;
-int yEnd = EsploraTFT.height()/2;
-
-// previous start and end positions
-int oldEndY;
-int oldStartY;
-
-void setup() {
- // initialize the display
- EsploraTFT.begin();
- // make the background black
- EsploraTFT.background(0,0,0);
-}
-
-void loop()
-{
- // read the x-axis of te accelerometer
- int tilt = Esplora.readAccelerometer(X_AXIS);
-
- // the values are 100 when tilted to the left
- // and -100 when tilted to the right
- // map these values to the start and end points
- yStart = map(tilt,-100,100,EsploraTFT.height(),0);
- yEnd = map(tilt,-100,100,0,EsploraTFT.height());
-
- // if the previous values are different than the current values
- // erase the previous line
- if (oldStartY != yStart || oldEndY != yEnd) {
- EsploraTFT.stroke(0,0,0);
- EsploraTFT.line(0, oldStartY, EsploraTFT.width(), oldEndY);
- }
-
- // draw the line in magenta
- EsploraTFT.stroke(255,0,255);
- EsploraTFT.line(0,yStart,EsploraTFT.width(),yEnd);
-
- // save the current start and end points
- // to compare int he next loop
- oldStartY= yStart;
- oldEndY = yEnd;
- delay(10);
-}