Dependencies: SSD1306 TSL2561 mbed DHT22 OneWire
Diff: main.cpp
- Revision:
- 0:9904b68365e4
- Child:
- 2:34f81c0f5176
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Oct 17 10:18:27 2017 +0000 @@ -0,0 +1,41 @@ +#include "mbed.h" +#define MOIST_PIN A3 +#define p_scl PA_9 +#define p_sda PA_10 +#include "TSL2561.h" +#include "ssd1306.h" +#include "standard_font.h" +#include "bold_font.h" + +SSD1306 oled(D3 /* cs */, A0 /* reset */, A7 /* dc */, + A1 /* clock */, A6 /* data */); +TSL2561 lum(PA_10,PA_9); +AnalogIn moisture(MOIST_PIN); + +int main() +{ + oled.initialise(); + oled.clear(); + oled.set_contrast(255); // max contrast + + oled.set_font(bold_font, 8); + oled.printf("Heading\r\n"); + + oled.set_font(standard_font, 6); + oled.printf("Hello World!\r\n"); + oled.printf("Some more text here..."); + + oled.update(); + + while (1) + { + wait(2); + oled.scroll_up(); + oled.update(); + oled.set_font(bold_font, 8); + //oled.printf("Quentin t cheum!\r\n"); + oled.printf("Moisture is %2.2f\r\n", (float) moisture); + oled.printf("Lum : %+5.1f lux\r\n", lum.lux()); + oled.printf("\n"); + } +} \ No newline at end of file