diff options
author | Cristian Maglie <c.maglie@bug.st> | 2013-08-23 15:59:24 +0200 |
---|---|---|
committer | Cristian Maglie <c.maglie@bug.st> | 2013-08-23 15:59:24 +0200 |
commit | 540743129b2badb813b703208d121ff14553c147 (patch) | |
tree | 6fadb4ebce68e1f0cb298a282be135c23fd156ed /libraries/TFT/examples/Arduino/TFTBitmapLogo | |
parent | 073b3ac9d4ae93ac0bb3a91afc65ae9d8f1d5d59 (diff) | |
parent | 67c84855c2f3ce99b091a756bb2ca1a016260659 (diff) |
Merge branch 'ide-1.5.x' into dev-ide-1.5.x-discovery
Conflicts:
app/src/processing/app/Preferences.java
app/src/processing/app/debug/Uploader.java
Diffstat (limited to 'libraries/TFT/examples/Arduino/TFTBitmapLogo')
-rw-r--r-- | libraries/TFT/examples/Arduino/TFTBitmapLogo/TFTBitmapLogo.ino | 108 | ||||
-rw-r--r-- | libraries/TFT/examples/Arduino/TFTBitmapLogo/arduino.bmp | bin | 6966 -> 0 bytes |
2 files changed, 0 insertions, 108 deletions
diff --git a/libraries/TFT/examples/Arduino/TFTBitmapLogo/TFTBitmapLogo.ino b/libraries/TFT/examples/Arduino/TFTBitmapLogo/TFTBitmapLogo.ino deleted file mode 100644 index da7a94d..0000000 --- a/libraries/TFT/examples/Arduino/TFTBitmapLogo/TFTBitmapLogo.ino +++ /dev/null @@ -1,108 +0,0 @@ -/* - - Arduino TFT Bitmap Logo example - - This example reads an image file from a micro-SD card - and draws it on the screen, at random locations. - - In this sketch, the Arduino logo is read from a micro-SD card. - There is a .bmp file included with this sketch. - - open the sketch folder (Ctrl-K or Cmd-K) - - copy the "arduino.bmp" file to a micro-SD - - put the SD into the SD slot of the Arduino TFT module. - - This example code is in the public domain. - - Created 19 April 2013 by Enrico Gueli - - http://arduino.cc/en/Tutorial/TFTBitmapLogo - - */ - -// include the necessary libraries -#include <SPI.h> -#include <SD.h> -#include <TFT.h> // Arduino LCD library - -// pin definition for the Uno -#define sd_cs 4 -#define lcd_cs 10 -#define dc 9 -#define rst 8 - -// pin definition for the Leonardo -//#define sd_cs 8 -//#define lcd_cs 7 -//#define dc 0 -//#define rst 1 - -TFT TFTscreen = TFT(lcd_cs, dc, rst); - -// this variable represents the image to be drawn on screen -PImage logo; - - -void setup() { - // initialize the GLCD and show a message - // asking the user to open the serial line - TFTscreen.begin(); - TFTscreen.background(255, 255, 255); - - TFTscreen.stroke(0, 0, 255); - TFTscreen.println(); - TFTscreen.println("Arduino TFT Bitmap Example"); - TFTscreen.stroke(0, 0, 0); - TFTscreen.println("Open serial monitor"); - TFTscreen.println("to run the sketch"); - - // initialize the serial port: it will be used to - // print some diagnostic info - Serial.begin(9600); - while (!Serial) { - // wait for serial line to be ready - } - - // clear the GLCD screen before starting - TFTscreen.background(255, 255, 255); - - // try to access the SD card. If that fails (e.g. - // no card present), the setup process will stop. - Serial.print("Initializing SD card..."); - if (!SD.begin(sd_cs)) { - Serial.println("failed!"); - return; - } - Serial.println("OK!"); - - // initialize and clear the GLCD screen - TFTscreen.begin(); - TFTscreen.background(255, 255, 255); - - // now that the SD card can be access, try to load the - // image file. - logo = TFTscreen.loadImage("arduino.bmp"); - if (!logo.isValid()) { - Serial.println("error while loading arduino.bmp"); - } -} - -void loop() { - // don't do anything if the image wasn't loaded correctly. - if (logo.isValid() == false) { - return; - } - - Serial.println("drawing image"); - - // get a random location where to draw the image. - // To avoid the image to be draw outside the screen, - // take into account the image size. - int x = random(TFTscreen.width() - logo.width()); - int y = random(TFTscreen.height() - logo.height()); - - // draw the image to the screen - TFTscreen.image(logo, x, y); - - // wait a little bit before drawing again - delay(1500); -} diff --git a/libraries/TFT/examples/Arduino/TFTBitmapLogo/arduino.bmp b/libraries/TFT/examples/Arduino/TFTBitmapLogo/arduino.bmp Binary files differdeleted file mode 100644 index 09c670a..0000000 --- a/libraries/TFT/examples/Arduino/TFTBitmapLogo/arduino.bmp +++ /dev/null |