Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By al555bike
#42821 Hi,
I have one of the cheap chinese tft's working with a nano using either the Adafruit 9340 or 9341library. I've been trying to get it to work on the NodeMCU, with little effect. Lots of errors at compile. Does anyone have a link to a suitable library? There are a number of demos on the web showing its use with nodeMCU, but I can't get any code to compile.
My initial errors are:

C:\Users\e11355\OneDrive\Arduino\libraries\Adafruit_ILI9340-master\Adafruit_ILI9340.cpp: In member function 'void Adafruit_ILI9340::spiwrite(uint8_t)':

C:\Users\e11355\OneDrive\Arduino\libraries\Adafruit_ILI9340-master\Adafruit_ILI9340.cpp:85:38: error: 'SET_BIT' was not declared in this scope

SET_BIT(mosiport, mosipinmask);

My code is
Code: Select all#include <ESP8266WiFi.h>
#include "SPI.h"
#include <Adafruit_GFX.h>
#include <Adafruit_ILI9340.h>

#define tft_sclk 14
#define tft_miso 12
#define tft_mosi 13
#define tft_cs 5
#define tft_dc 2
#define tft_rst 1

Adafruit_ILI9340 tft = Adafruit_ILI9340(tft_cs, tft_dc,tft_rst);

void setup() {
  Serial.begin(115200);
   Serial.println("ILI9340 Test!");   
 tft.begin();
 tft.setRotation(1);
 tft.fillScreen(ILI9340_WHITE);
 tft.setTextColor(ILI9340_BLACK);
 tft.setTextSize(2);
 tft.setCursor(20,46);
 tft.println("Hello World!");
}
void loop() { 
    while(1)
    {
      ;
    }
}
User avatar
By al555bike
#43791 Managed to get my display working. The solution was the library. I found this ebook

http://www.amazon.co.uk/Nodemcu-dev-kit-using-Arduino-ebook/dp/B01A1R31K2/ref=sr_1_7?ie=UTF8&qid=1458650292&sr=8-7&keywords=nodemcu

on Amazon and a link at the end took me to a modified libary. It now works really well as do all the examples in the ebook.
The book has several worked examples which would be good for a new user. :D