aboutsummaryrefslogtreecommitdiff
path: root/libraries/TFT/examples/Arduino/TFTGraph/TFTGraph.ino
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/Arduino/TFTGraph/TFTGraph.ino
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/Arduino/TFTGraph/TFTGraph.ino')
-rw-r--r--libraries/TFT/examples/Arduino/TFTGraph/TFTGraph.ino71
1 files changed, 0 insertions, 71 deletions
diff --git a/libraries/TFT/examples/Arduino/TFTGraph/TFTGraph.ino b/libraries/TFT/examples/Arduino/TFTGraph/TFTGraph.ino
deleted file mode 100644
index 39ae49b..0000000
--- a/libraries/TFT/examples/Arduino/TFTGraph/TFTGraph.ino
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-
- TFT Graph
-
- This example for an Arduino screen reads
- the value of an analog sensor on A0, and
- graphs the values on the screen.
-
- This example code is in the public domain.
-
- Created 15 April 2013 by Scott Fitzgerald
-
- http://arduino.cc/en/Tutorial/TFTGraph
-
- */
-
-#include <TFT.h> // Arduino LCD library
-#include <SPI.h>
-
- // pin definition for the Uno
-#define cs 10
-#define dc 9
-#define rst 8
-
-// pin definition for the Leonardo
-// #define cs 7
-// #define dc 0
-// #define rst 1
-
-TFT TFTscreen = TFT(cs, dc, rst);
-
-// position of the line on screen
-int xPos = 0;
-
-void setup(){
- // initialize the serial port
- Serial.begin(9600);
-
- // initialize the display
- TFTscreen.begin();
-
- // clear the screen with a pretty color
- TFTscreen.background(250,16,200);
-}
-
-void loop(){
- // read the sensor and map it to the screen height
- int sensor = analogRead(A0);
- int drawHeight = map(sensor,0,1023,0,TFTscreen.height());
-
- // print out the height to the serial monitor
- Serial.println(drawHeight);
-
- // draw a line in a nice color
- TFTscreen.stroke(250,180,10);
- TFTscreen.line(xPos, TFTscreen.height()-drawHeight, xPos, TFTscreen.height());
-
- // if the graph has reached the screen edge
- // erase the screen and start again
- if (xPos >= 160) {
- xPos = 0;
- TFTscreen.background(250,16,200);
- }
- else {
- // increment the horizontal position:
- xPos++;
- }
-
- delay(16);
-}
-