mbed example application for the Adafruit ST7735 TFT Shield, which implements SPI connections to the TFT shield and SD card, as well as an ADC to read from the analog in pins.
Dependencies: Adafruit_GFX Adafruit_ST7735 SDFileSystem mbed-os
Fork of mbed-TFT-example-NCS36510 by
main.cpp@0:8fbbced097c5, 2017-01-25 (annotated)
- Committer:
- jacobjohnson
- Date:
- Wed Jan 25 18:51:37 2017 +0000
- Revision:
- 0:8fbbced097c5
- Child:
- 2:fa3fb1787cf8
Working example code for Grove OLED for NCS36510;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jacobjohnson | 0:8fbbced097c5 | 1 | #include "mbed.h" |
jacobjohnson | 0:8fbbced097c5 | 2 | #include "SeeedGrayOLED.h" |
jacobjohnson | 0:8fbbced097c5 | 3 | |
jacobjohnson | 0:8fbbced097c5 | 4 | DigitalOut led1(LED1); |
jacobjohnson | 0:8fbbced097c5 | 5 | SeeedGrayOLED SeeedGrayOled(I2C1_SDATA_1, I2C1_SCLK_1); |
jacobjohnson | 0:8fbbced097c5 | 6 | |
jacobjohnson | 0:8fbbced097c5 | 7 | int main() { |
jacobjohnson | 0:8fbbced097c5 | 8 | |
jacobjohnson | 0:8fbbced097c5 | 9 | SeeedGrayOled.init(); |
jacobjohnson | 0:8fbbced097c5 | 10 | SeeedGrayOled.clearDisplay(); |
jacobjohnson | 0:8fbbced097c5 | 11 | SeeedGrayOled.setNormalDisplay(); |
jacobjohnson | 0:8fbbced097c5 | 12 | SeeedGrayOled.setVerticalMode(); |
jacobjohnson | 0:8fbbced097c5 | 13 | |
jacobjohnson | 0:8fbbced097c5 | 14 | while (true) |
jacobjohnson | 0:8fbbced097c5 | 15 | { |
jacobjohnson | 0:8fbbced097c5 | 16 | for(char i=1; i<11; i++) |
jacobjohnson | 0:8fbbced097c5 | 17 | { |
jacobjohnson | 0:8fbbced097c5 | 18 | led1 = !led1; |
jacobjohnson | 0:8fbbced097c5 | 19 | SeeedGrayOled.setTextXY(i,1); //1st row, 0th column |
jacobjohnson | 0:8fbbced097c5 | 20 | SeeedGrayOled.setGrayLevel(i); //Set Grayscale level. Any number between 0 - 15. |
jacobjohnson | 0:8fbbced097c5 | 21 | SeeedGrayOled.putString("Hello World"); |
jacobjohnson | 0:8fbbced097c5 | 22 | Thread::wait(10); |
jacobjohnson | 0:8fbbced097c5 | 23 | } |
jacobjohnson | 0:8fbbced097c5 | 24 | Thread::wait(5000); |
jacobjohnson | 0:8fbbced097c5 | 25 | } |
jacobjohnson | 0:8fbbced097c5 | 26 | } |
jacobjohnson | 0:8fbbced097c5 | 27 |