Toyomasa Watarai
/
Wio_3G_HTTP-GET-Firebase-example
Wio 3G with Firebase example
Fork of Wio_3G_HTTP-GET-example by
Diff: main.cpp
- Revision:
- 71:7d17edde2e03
- Parent:
- 70:cb6d36218441
- Child:
- 72:aa14c091f860
--- a/main.cpp Fri Aug 03 05:22:15 2018 +0000 +++ b/main.cpp Fri Aug 03 06:46:00 2018 +0000 @@ -1,5 +1,5 @@ #include "mbed.h" -#include "DigitDisplay.h" +#include "Grove_LCD_RGB_Backlight.h" #define D20 (PB_4) #define D19 (PB_3) @@ -8,15 +8,9 @@ DigitalOut led1(D38); AnalogIn ain(A6); InterruptIn btn(D20); - -DigitDisplay display(RXD, TXD); // 4-Digit Display connected to UART Grove connector +Grove_LCD_RGB_Backlight rgbLCD(I2C_SDA, I2C_SCL); -Ticker ticker; -volatile uint8_t second = 0; -volatile uint8_t minute = 0; -volatile uint8_t hour = 12; -volatile bool colon_enable = false; - +uint32_t button = 0; /// @@ -25,7 +19,7 @@ const int B = 4275; // B value of the thermistor const int R0 = 100000; // R0 = 100k AnalogIn temp(A4); - + float R = 1.0f/temp.read() - 1.0f; R = R0*R; @@ -35,45 +29,27 @@ /// -void tick() -{ - colon_enable = !colon_enable; - display.setColon(colon_enable); - - if (colon_enable) { - second++; - if (second >= 60) { - second = 0; - minute++; - if (minute >= 60) { - minute = 0; - hour++; - if (hour >= 24) { - hour = 0; - } - } - display.write(hour * 100 + minute); - } - } -} - void push() { - printf("*"); + button++; } // main() runs in its own thread in the OS int main() { - display.write(hour * 100 + minute); - ticker.attach(tick, 0.5); - btn.fall(push); + rgbLCD.clear(); + rgbLCD.setRGB(0xff, 0x00, 0x00); + rgbLCD.locate(0, 0); + rgbLCD.print("Hello World!"); + rgbLCD.locate(0, 1); + rgbLCD.print("This is a test"); + int cnt = 0; printf("hello, Mbed world\n"); while (true) { - printf("count = %4d, analog = %f, temp = %f\n", cnt++, ain.read(), get_temp()); + printf("count = %4d, button = %d, analog = %f, temp = %f\n", cnt++, button, ain.read(), get_temp()); led1 = !led1; wait(0.5); }