Yesterday, Jak shared with us on the forum his work connecting a CANZERO node to a nice big TFT display.
More precisely, he successfully connected a CANZERO to an Adafruit RA8875 driver board (https://www.adafruit.com/product/1590) and a 7 inch TFT display (https://www.adafruit.com/product/2354).
The demo code shared by Jak below will simply make the screen go fully black or white depending on a message sent on the NoCAN network. It seems easy enough to extend to print text or graphics on the screen based on messages.
// // Demo sketch connecting a CANZERO to Adafruit RA8875 graphics driver board connected to a 7 inch 800x480 TFT display // // Warning, there is no error handling... // // jak.mang // 02/17/19 #include <Adafruit_GFX.h> #include <Adafruit_RA8875.h> #include <nocan.h> // Pin Out RA8875 -> CANZERO // Vin: +5V // GND: GND // 3Vo: not connected (or use for the SPI fix circuit described in wiki) // Lite: not connected // SCK: SPI SCK // MISO: SPI MISO (remember that it's not tristate! see SPI fix circuit if you want add some SPI device) // MOSI: SPI MOSI // CS: SPI CS Used Pin 7 // RST: Any MCU Pin or 10K resistor tied to 3V3 used Pin 6 // WAIT: Not used // INT: Any MCU pin used Pin 2 #define RA8875_INT 2 //any pin #define RA8875_CS 7 //any pin #define RA8875_RST 6 //any pin Adafruit_RA8875 tft = Adafruit_RA8875(RA8875_CS,RA8875_RST); void setup() { NocanChannelId cid; if (tft.begin(RA8875_800x480)) { tft.displayOn(true); tft.GPIOX(true); // Enable TFT - display enable tied to GPIOX tft.PWM1config(true, RA8875_PWM_CLK_DIV1024); // PWM output for backlight tft.PWM1out(255); tft.fillScreen(RA8875_BLACK); tft.fillScreen(RA8875_WHITE); } Nocan.open(); Nocan.registerChannel("display", &cid); Nocan.subscribeChannel(cid); pinMode(LED_BUILTIN, OUTPUT); } void loop() { NocanMessage msg; Nocan.receiveMessage(&msg); if (msg.data[0] == 'o') { // Turn on LED digitalWrite(LED_BUILTIN, HIGH); // Turn screen black tft.fillScreen(RA8875_BLACK); } else if (msg.data[0] == 'x') { // Turn off LED digitalWrite(LED_BUILTIN, LOW); // Turn screen white tft.fillScreen(RA8875_WHITE); } }
Comments
hi
what is going on wit wiring pi library ??
have u got alternative solution to make your product working again ??
robin
robert , 9 months agoLeave a comment