I have a Freetronics Eleven (100% Arduino Uno compatible) connected to an Arduino 1.77" SPI TFT LCD Display. I'm using the TFT Display Text tutorial at http://arduino.cc/en/Tutorial/TFTDisplayText. When I upload the sketch the display white backlight activates but nothing else happens. Could it be a compatibility problem with the Uno-copy board?
How do I get it to display anything?
Also, I don't have a micro SD fitted: is that necessary?
The example doesn't require SD card and it is written for hardware SPI use which means MOSI (pin 11) and SCLK (pin 13) by default. Could you post your code and how are you connecting the 11/LCD? Regards.
Here is my code that I had literally copied and pasted into Arduino IDE from the tutorial to be sure I hadn't made a typo.
#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
// create an instance of the library
TFT TFTscreen = TFT(cs, dc, rst);
// char array to print to the screen
char sensorPrintout[4];
void setup() {
// Put this line at the beginning of every sketch that uses the GLCD:
TFTscreen.begin();
// clear the screen with a black background
TFTscreen.background(0, 0, 0);
// write the static text to the screen
// set the font color to white
TFTscreen.stroke(255,255,255);
// set the font size
TFTscreen.setTextSize(2);
// write the text to the top left corner of the screen
TFTscreen.text("Sensor Value :\n ",0,0);
// ste the font size very large for the loop
TFTscreen.setTextSize(5);
}
void loop() {
// Read the value of the sensor on A0
String sensorVal = String(analogRead(A0));
// convert the reading to a char array
sensorVal.toCharArray(sensorPrintout, 4);
// set the font color
TFTscreen.stroke(255,255,255);
// print the sensor value
TFTscreen.text(sensorPrintout, 0, 20);
// wait for a moment
delay(250);
// erase the text you just wrote
TFTscreen.stroke(0,0,0);
TFTscreen.text(sensorPrintout, 0, 20);
}
I'm connecting exactly (I've double and triple checked) as per this image on the tutorial.
Might SPI work a bit differently with the eleven even though it's supposed to be Uno compatible? I don't know a lot about SPI.
Alright. I've uploaded your code but the screen is still white i.e. there is no change in what is being displayed.
The hardwired LED to pin D13 does flash every second so the board is sending something to SCLK pin though.
It's almost like the display won't accept commands; as soon as I power up the eleven board the display just lights up the backlight and stays like that.
Okay, I've uninstalled my old version and started installing 1.5.6-r2 but this error came up some way through the installation process:
Error opening file for writing:
C:\Program Files (x86)\Arduino\java\bin\awt.dll
Click Abort to stop the installation,
Retry to try again, or
Ignore to skip this file.
I tried Retry but the same error happened. Any ideas?
Update: I ignored the error (and 4 or 5 subsequent and similar errors) and it installed. I tried uploading the code you've posted and it successfully compiled and uploaded but nothing different is happening with the display.
Update 2: Investigating the error I just worked out it is related to something else (that I've now dealt with) on my computer. I've re-installed 1.5.6r-2 with no errors now. However, again there is no luck with the display.
Hello Thorium234,
Are you powering the Arduino only through the USB connector? If so, can you try using an external power supply?
It's known that some LCDs (like some modems) have high power consumption to work accordingly. Regards,
Palliser, so far I've only been using the USB port from my computer.
Okay, now I've plugged a 7.2V RC car battery (fully charged and hence supplying a higher value of 8.5V) into the eleven's DC jack. The display still doesn't do anything. I measured the potential difference across the +5V pin and GND pin on the display whilst powered up and it shows 4.9V from both USB and DC jack power. I suspect this is due to the eleven's on-board regulator cutting down the battery's input to the required 5V.
Perhaps the display needs its own power supply? But I fear the 8.5V from the battery would be too much going straight into the display.
It's rewired as indicated in the link and I just tried running it with both USB and then battery. I uploaded the sketch you offered above to test the tftScreen.background function but nothing happened. The screen comes on white as soon as the eleven has power. In fact, if I remove all leads but for +5V and GND to the display it still comes on white and does nothing.
Let's now test the SPI port of your eleven.
With your eleven alone, make a jumper between pins 11 (MOSI) and 12 (MISO).
The following code will send and receive a string via the SPI port.
If the test is successful, you should see the string "SPI TEST OK" in the serial monitor of the Arduino IDE.
//Loop Back test for the SPI port of the Arduino
#include <SPI.h>
char outByte [20] = "SPI TEST OK";
char inByte;
int i = 0;
void setup()
{
Serial.begin(9600);
SPI.begin();
delay(100);
}
void loop()
{
for(i = 0; outByte [i] != '\0'; i ++)
{
inByte = SPI.transfer(outByte [i]);
Serial.write(inByte);
}
Serial.println();
delay(1000);
}
Yes. I wanted to discard a possible issue with your eleven or the SPI library. Thus, the problem could be with the TFT library or the LCD shield. Regarding both the 1.0.5 only works with the red tab that your LCD had (The plastic cover on the screen) and the 1.5.6 works with the green tab. DO you remember what tab your screen had? I'm about to sleep now but let's keep in touch. Night.
Hello Thorium234,
Green tag. Thank for the info. This meas that you have the new version of the LCD and that runs by default with the 1.5.X.
Given that the Arduino LCD TFT library is based on the Adafruit one, please, try the following test code (equivalent to my previous one) that I have prepared using the Adafruit library and let's see how it goes.
Notes:
-Use the Arduin IDE 1.5.6-r2.
-Use the last wiring I told you from: http://arduino.cc/en/Guide/TFTtoBoards#.UyWQNNyP4p0
Palliser, I checked my wiring to that in the link and my IDE version (1.5.6-r2 as required) and then uploaded the new test code. However, the display continues to taunt me with a blank white screen.