![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
working mbed program for Adafruit ST7735
Dependencies: Adafruit_GFX Adafruit_ST7735 SDFileSystem mbed-os
Fork of mbed-OLED-example-NCS36510 by
Diff: main.cpp
- Revision:
- 2:fa3fb1787cf8
- Parent:
- 0:8fbbced097c5
--- a/main.cpp Wed Jan 25 20:58:55 2017 +0000 +++ b/main.cpp Tue Jan 31 17:16:30 2017 +0000 @@ -1,27 +1,41 @@ +/*************************************** +This is a working copy. It is not finished. +***************************************/ + #include "mbed.h" -#include "SeeedGrayOLED.h" +#include "Adafruit_ST7735.h" +#include "SDFileSystem.h" +//#include <string> DigitalOut led1(LED1); -SeeedGrayOLED SeeedGrayOled(I2C1_SDATA_1, I2C1_SCLK_1); +SDFileSystem sd(D11, D12, D13, D4, "SD"); // the pinout on the mbed // mosi, miso, sclk, cs +Adafruit_ST7735 tft(D11, D12, D13, D10, D6, D9); // MOSI, MISO, SCLK, SSEL, TFT_DC, TFT_RST +AnalogIn joystick(A3); +uint8_t readButton(void); + +// main() runs in its own thread in the OS +// (note the calls to wait below for delays) int main() { - - SeeedGrayOled.init(); - SeeedGrayOled.clearDisplay(); - SeeedGrayOled.setNormalDisplay(); - SeeedGrayOled.setVerticalMode(); + + tft.initR(INITR_BLACKTAB); // initialize a ST7735S chip, black tab + tft.fillScreen(ST7735_BLACK); - while (true) - { - for(char i=1; i<11; i++) - { - led1 = !led1; - SeeedGrayOled.setTextXY(i,1); //1st row, 0th column - SeeedGrayOled.setGrayLevel(i); //Set Grayscale level. Any number between 0 - 15. - SeeedGrayOled.putString("Hello World"); - Thread::wait(10); - } - Thread::wait(5000); + int result = tft.DrawBitmapFile("/SD/ON.bmp"); + + while (true) { + + float b = joystick.read(); + + tft.setTextColor(ST7735_GREEN); + //tft.setCursor(0, 60); //claims that this is not in the Adafruit_ST7735 library? How are these files linked together? + tft.printf("%f \n\r", b); + printf("%f \n\r", b); + wait_ms(100); + + } } + +