Wio 3G with Firebase example
Fork of Wio_3G_HTTP-GET-example by
Revision 71:7d17edde2e03, committed 2018-08-03
- Comitter:
- MACRUM
- Date:
- Fri Aug 03 06:46:00 2018 +0000
- Parent:
- 70:cb6d36218441
- Child:
- 72:aa14c091f860
- Commit message:
- Remove 4-Digit display, add Grove LCD RGB backlight
Changed in this revision
--- a/DigitDisplay.lib Fri Aug 03 05:22:15 2018 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -https://os.mbed.com/teams/Seeed/code/DigitDisplay/#d3173c8bfd48
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Grove_LCD_RGB_Backlight.lib Fri Aug 03 06:46:00 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/cmatz3/code/Grove_LCD_RGB_Backlight/#5ce38ef7a7db
--- 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);
}
Toyomasa Watarai
