Dependencies: SSD1306 TSL2561 mbed DHT22 OneWire
main.cpp
- Committer:
- Aureb29
- Date:
- 2017-10-17
- Revision:
- 0:9904b68365e4
- Child:
- 2:34f81c0f5176
File content as of revision 0:9904b68365e4:
#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"); } }