working mbed program for Adafruit ST7735

Dependencies:   Adafruit_GFX Adafruit_ST7735 SDFileSystem mbed-os

Fork of mbed-OLED-example-NCS36510 by ON Semiconductor

main.cpp

Committer:
jacobjohnson
Date:
2017-01-31
Revision:
2:fa3fb1787cf8
Parent:
0:8fbbced097c5

File content as of revision 2:fa3fb1787cf8:

/***************************************
This is a working copy. It is not finished.
***************************************/

#include "mbed.h"
#include "Adafruit_ST7735.h"
#include "SDFileSystem.h"
//#include <string>

DigitalOut led1(LED1);
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() {
    
    tft.initR(INITR_BLACKTAB);   // initialize a ST7735S chip, black tab
    tft.fillScreen(ST7735_BLACK);
    
    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);
        
        
    }
}