Go Down

Topic: TFT shield on Arduino UNO I2C with nodemcu  (Read 111 times) previous topic - next topic

jetchirag

Aug 18, 2018, 08:51 am Last Edit: Aug 18, 2018, 09:11 am by jetchirag
Hello,

I'm trying to connect a cheap 2.4" tft screen to a uno which will act as a slave to nodemcu. I've hooked up the screen and connected the A4 and A5 to D1 and D2 pins on nodemcu.

On the product page, they've provided that

Quote
That means you can use digital pins 2, 3 and analog 4 and 5.
But when I add

Code: [Select]
Wire.begin(8);

The screen goes blank.

So, this works:

Code: [Select]
#include <Wire.h>
#include <SPFD5408_Adafruit_GFX.h>    // Core graphics library
#include <SPFD5408_Adafruit_TFTLCD.h> // Hardware-specific library

// LCD Pin

#define LCD_CS A3 // CS
#define LCD_CD A2 // RS
#define LCD_WR A1 // WR
#define LCD_RD A0 // RD
#define LCD_RESET A4 // Optional : otherwise connect to Arduino's reset pin

// Assign human-readable names to some common 16-bit color values:
#define BLACK   0x0000
#define BLUE    0x001F
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF

// Init LCD

Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);

void setup(void) {
   
  tft.reset();
  tft.begin(0x9341);
  tft.setRotation(0);

  tft.fillScreen(WHITE);

  tft.setCursor (0, 20);
  tft.setTextSize (4);
  tft.setTextColor(RED);
  tft.println("ABC123");

 }
 
void loop()
{
  delay(100);
}


This does not:

Code: [Select]
#include <Wire.h>
#include <SPFD5408_Adafruit_GFX.h>    // Core graphics library
#include <SPFD5408_Adafruit_TFTLCD.h> // Hardware-specific library

// LCD Pin

#define LCD_CS A3 // CS
#define LCD_CD A2 // RS
#define LCD_WR A1 // WR
#define LCD_RD A0 // RD
#define LCD_RESET A4 // Optional : otherwise connect to Arduino's reset pin

// Assign human-readable names to some common 16-bit color values:
#define BLACK   0x0000
#define BLUE    0x001F
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF

// Init LCD

Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);

void setup(void) {
   Wire.begin(8);   
   
  tft.reset();
  tft.begin(0x9341);
  tft.setRotation(0);

  tft.fillScreen(WHITE);

  tft.setCursor (0, 20);
  tft.setTextSize (4);
  tft.setTextColor(RED);
  tft.println("ABC123");

 }
 
void loop()
{
  delay(100);
}


As the screen allows those pins to be used, what am I missing?

noiasca

I2C on UNO is on A4 and A5.

The sketch uses

#define LCD_RESET A4 //

for lcd.



Use a different PIN for LCD_RESET and you should be fine.
DE: Wie man Fragen postet:
1. was hat man (Sketch und Hardware)
2. was SOLL es machen
3. was macht es: IST (Fehlverhalten, Fehlermeldungen, Serial.Output ...)
4. Eine Frage stellen bzw. erklären was man erwartet

Go Up