Hi All...
I have a display and Arduino shield that I never used and would like to know if It will work on an Uno R3 instead of a Due or Mega. It comes with a shield ER-AS-SSD1963 , the pinout matched up with both the Due and Uno. I bought everything from buydisplay.com where they give you data sheets for the shield and the display. They include libraries and sample sketches to test it but it's only written for a Due or Mega. I don't see any good examples of people running an SSD1963 based shield on an Uno but a few things make me think it's possible. There is a video of someone running a 4.3" inch SSD1963 based shield on an Uno but they don't post and info on it. The buydisplay page for the shield and screen combo say it works with an Uno but they provide no info on it.
I figured I would just compile the code below and upload it to an Uno just to see what happened since the current draw was within the Uno's limits and the shield pinout lines up. Of course it didn't work as expected but the display did turn on with a white screen and an arrow. It flickered and turned on and off as the program ran. I added an external 5V supply to the shield while powering the Uno with 12V and it made no difference. I know the screen works as I tested it with a Due when I first got it.
I only plan to display the state of four relays and the value of four voltage sensors via the analog pins. Simple text is fine, although fancy pictures and colors would be nice.
Here's the no touch display test code, can it be shortened and made to work on an Uno?
/***************************************************
//Web: http://www.buydisplay.com
EastRising Technology Co.,LTD
Examples for ER-TFTM050-4(480x272 Pixels)
Software SPI,8080 16-bit Interface 5V Power Supply
This program is a demo of how to use most of the functions
of the library with a supported display modules.
Tested and worked with:
Arduino Mega 2560,Arduino Due
Works with Arduino 1.6.0 IDE
****************************************************/
#include <UTFT.h>
// Declare which fonts we will be using
extern uint8_t SmallFont[];
// Set the pins to the correct ones for your development shield
// ------------------------------------------------------------
// Standard Arduino Mega/Due shield : <display model>,38,39,40,41
// Remember to change the model parameter to suit your display module!
UTFT myGLCD(SSD1963_480272, 38, 39, 40, 41); //(byte model, int RS, int WR, int CS, int RST, int SER)
void setup() {
randomSeed(analogRead(0));
// Setup the LCD
myGLCD.InitLCD();
// -------------------------------------------------------------
pinMode(8, OUTPUT); //backlight
digitalWrite(8, HIGH); //on
// -------------------------------------------------------------
myGLCD.setFont(SmallFont);
}
void loop() {
int buf[478];
int x, x2;
int y, y2;
int r;
// Clear the screen and draw the frame
myGLCD.clrScr();
myGLCD.setColor(255, 0, 0);
myGLCD.fillRect(0, 0, 479, 13);
myGLCD.setColor(64, 64, 64);
myGLCD.fillRect(0, 258, 479, 271);
myGLCD.setColor(255, 255, 255);
myGLCD.setBackColor(255, 0, 0);
myGLCD.print("* Universal Color TFT Display Library *", CENTER, 1);
myGLCD.setBackColor(64, 64, 64);
myGLCD.setColor(255, 255, 0);
myGLCD.print("<http://www.buydisplay.com>", CENTER, 259);
myGLCD.setColor(0, 0, 255);
myGLCD.drawRect(0, 14, 479, 257);
// Draw crosshairs
myGLCD.setColor(0, 0, 255);
myGLCD.setBackColor(0, 0, 0);
myGLCD.drawLine(239, 15, 239, 256);
myGLCD.drawLine(1, 135, 478, 135);
for (int i = 9; i < 470; i += 10)
myGLCD.drawLine(i, 133, i, 138);
for (int i = 15; i < 256; i += 10)
myGLCD.drawLine(237, i, 241, i);
// Draw sin-, cos- and tan-lines
myGLCD.setColor(0, 255, 255);
myGLCD.print("Sin", 5, 15);
for (int i = 1; i < 478; i++) {
myGLCD.drawPixel(i, 135 + (sin(((i * 1.13) * 3.14) / 180) * 95));
}
myGLCD.setColor(255, 0, 0);
myGLCD.print("Cos", 5, 27);
for (int i = 1; i < 478; i++) {
myGLCD.drawPixel(i, 135 + (cos(((i * 1.13) * 3.14) / 180) * 95));
}
myGLCD.setColor(255, 255, 0);
myGLCD.print("Tan", 5, 39);
for (int i = 1; i < 478; i++) {
myGLCD.drawPixel(i, 135 + (tan(((i * 1.13) * 3.14) / 180)));
}
delay(2000);
myGLCD.setColor(0, 0, 0);
myGLCD.fillRect(1, 15, 478, 256);
myGLCD.setColor(0, 0, 255);
myGLCD.setBackColor(0, 0, 0);
myGLCD.drawLine(239, 15, 239, 256);
myGLCD.drawLine(1, 135, 478, 135);
// Draw a moving sinewave
x = 1;
for (int i = 1; i < (478 * 20); i++) {
x++;
if (x == 479)
x = 1;
if (i > 479) {
if ((x == 239) || (buf[x - 1] == 135))
myGLCD.setColor(0, 0, 255);
else
myGLCD.setColor(0, 0, 0);
myGLCD.drawPixel(x, buf[x - 1]);
}
myGLCD.setColor(0, 255, 255);
y = 135 + (sin(((i * 1.65) * 3.14) / 180) * (90 - (i / 100)));
myGLCD.drawPixel(x, y);
buf[x - 1] = y;
}
delay(2000);
myGLCD.setColor(0, 0, 0);
myGLCD.fillRect(1, 15, 478, 256);
// Draw some filled rectangles
for (int i = 1; i < 6; i++) {
switch (i) {
case 1:
myGLCD.setColor(255, 0, 255);
break;
case 2:
myGLCD.setColor(255, 0, 0);
break;
case 3:
myGLCD.setColor(0, 255, 0);
break;
case 4:
myGLCD.setColor(0, 0, 255);
break;
case 5:
myGLCD.setColor(255, 255, 0);
break;
}
myGLCD.fillRect(150 + (i * 20), 46 + (i * 20), 210 + (i * 20), 106 + (i * 20));
}
delay(2000);
myGLCD.setColor(0, 0, 0);
myGLCD.fillRect(1, 15, 478, 256);
// Draw some filled, rounded rectangles
for (int i = 1; i < 6; i++) {
switch (i) {
case 1:
myGLCD.setColor(255, 0, 255);
break;
case 2:
myGLCD.setColor(255, 0, 0);
break;
case 3:
myGLCD.setColor(0, 255, 0);
break;
case 4:
myGLCD.setColor(0, 0, 255);
break;
case 5:
myGLCD.setColor(255, 255, 0);
break;
}
myGLCD.fillRoundRect(330 - (i * 20), 46 + (i * 20), 270 - (i * 20), 106 + (i * 20));
}
delay(2000);
myGLCD.setColor(0, 0, 0);
myGLCD.fillRect(1, 15, 478, 256);
// Draw some filled circles
for (int i = 1; i < 6; i++) {
switch (i) {
case 1:
myGLCD.setColor(255, 0, 255);
break;
case 2:
myGLCD.setColor(255, 0, 0);
break;
case 3:
myGLCD.setColor(0, 255, 0);
break;
case 4:
myGLCD.setColor(0, 0, 255);
break;
case 5:
myGLCD.setColor(255, 255, 0);
break;
}
myGLCD.fillCircle(180 + (i * 20), 75 + (i * 20), 30);
}
delay(2000);
myGLCD.setColor(0, 0, 0);
myGLCD.fillRect(1, 15, 478, 256);
// Draw some lines in a pattern
myGLCD.setColor(255, 0, 0);
for (int i = 15; i < 256; i += 5) {
myGLCD.drawLine(1, i, (i * 1.88) - 10, 256);
}
myGLCD.setColor(255, 0, 0);
for (int i = 256; i > 15; i -= 5) {
myGLCD.drawLine(478, i, (i * 1.88) - 11, 15);
}
myGLCD.setColor(0, 255, 255);
for (int i = 256; i > 15; i -= 5) {
myGLCD.drawLine(1, i, 491 - (i * 1.88), 15);
}
myGLCD.setColor(0, 255, 255);
for (int i = 15; i < 256; i += 5) {
myGLCD.drawLine(478, i, 490 - (i * 1.88), 256);
}
delay(2000);
myGLCD.setColor(0, 0, 0);
myGLCD.fillRect(1, 15, 478, 256);
// Draw some random circles
for (int i = 0; i < 150; i++) {
myGLCD.setColor(random(255), random(255), random(255));
x = 32 + random(416);
y = 45 + random(178);
r = random(30);
myGLCD.drawCircle(x, y, r);
}
delay(2000);
myGLCD.setColor(0, 0, 0);
myGLCD.fillRect(1, 15, 478, 256);
// Draw some random rectangles
for (int i = 0; i < 150; i++) {
myGLCD.setColor(random(255), random(255), random(255));
x = 2 + random(476);
y = 16 + random(239);
x2 = 2 + random(476);
y2 = 16 + random(239);
myGLCD.drawRect(x, y, x2, y2);
}
delay(2000);
myGLCD.setColor(0, 0, 0);
myGLCD.fillRect(1, 15, 478, 256);
// Draw some random rounded rectangles
for (int i = 0; i < 150; i++) {
myGLCD.setColor(random(255), random(255), random(255));
x = 2 + random(476);
y = 16 + random(239);
x2 = 2 + random(476);
y2 = 16 + random(239);
myGLCD.drawRoundRect(x, y, x2, y2);
}
delay(2000);
myGLCD.setColor(0, 0, 0);
myGLCD.fillRect(1, 15, 478, 256);
for (int i = 0; i < 150; i++) {
myGLCD.setColor(random(255), random(255), random(255));
x = 2 + random(476);
y = 16 + random(239);
x2 = 2 + random(476);
y2 = 16 + random(239);
myGLCD.drawLine(x, y, x2, y2);
}
delay(2000);
myGLCD.setColor(0, 0, 0);
myGLCD.fillRect(1, 15, 478, 256);
for (int i = 0; i < 10000; i++) {
myGLCD.setColor(random(255), random(255), random(255));
myGLCD.drawPixel(2 + random(476), 16 + random(239));
}
delay(2000);
myGLCD.fillScr(0, 0, 255);
myGLCD.setColor(255, 0, 0);
myGLCD.fillRoundRect(160, 70, 319, 169);
myGLCD.setColor(255, 255, 255);
myGLCD.setBackColor(255, 0, 0);
myGLCD.print("That's it!", CENTER, 93);
myGLCD.print("Restarting in a", CENTER, 119);
myGLCD.print("few seconds...", CENTER, 132);
myGLCD.setColor(0, 255, 0);
myGLCD.setBackColor(0, 0, 255);
myGLCD.print("Runtime: (msecs)", CENTER, 243);
myGLCD.printNumI(millis(), CENTER, 258);
delay(10000);
}