【mbed OS5対応バージョン】データの保存、更新、取得ができるWebサービス「milkcocoa」に接続し、データのプッシュ、送信、取得ができるライブラリです。 https://mlkcca.com/

Dependents:   mbed-os-example-wifi-milkcocoa MilkcocoaOsSample_Eth MilkcocoaOsSample_ESP8266 MilkcocoaOsSample_Eth_DigitalIn

Committer:
jksoft
Date:
Mon Mar 26 04:49:20 2018 +0000
Revision:
13:61e0cc093180
Parent:
10:c52abd2d6595
???????????

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jksoft 10:c52abd2d6595 1 #if !defined(MQTT_MBED_H)
jksoft 10:c52abd2d6595 2 #define MQTT_MBED_H
jksoft 10:c52abd2d6595 3
jksoft 10:c52abd2d6595 4 #include "mbed.h"
jksoft 10:c52abd2d6595 5
jksoft 10:c52abd2d6595 6 #include "OldTimer.h"
jksoft 10:c52abd2d6595 7
jksoft 10:c52abd2d6595 8 class Countdown
jksoft 10:c52abd2d6595 9 {
jksoft 10:c52abd2d6595 10 public:
jksoft 10:c52abd2d6595 11 Countdown()
jksoft 10:c52abd2d6595 12 {
jksoft 10:c52abd2d6595 13 t = OldTimer();
jksoft 10:c52abd2d6595 14 }
jksoft 10:c52abd2d6595 15
jksoft 10:c52abd2d6595 16 Countdown(int ms)
jksoft 10:c52abd2d6595 17 {
jksoft 10:c52abd2d6595 18 t = OldTimer();
jksoft 10:c52abd2d6595 19 countdown_ms(ms);
jksoft 10:c52abd2d6595 20 }
jksoft 10:c52abd2d6595 21
jksoft 10:c52abd2d6595 22
jksoft 10:c52abd2d6595 23 bool expired()
jksoft 10:c52abd2d6595 24 {
jksoft 10:c52abd2d6595 25 return t.read_ms() >= interval_end_ms;
jksoft 10:c52abd2d6595 26 }
jksoft 10:c52abd2d6595 27
jksoft 10:c52abd2d6595 28 void countdown_ms(unsigned long ms)
jksoft 10:c52abd2d6595 29 {
jksoft 10:c52abd2d6595 30 t.stop();
jksoft 10:c52abd2d6595 31 interval_end_ms = ms;
jksoft 10:c52abd2d6595 32 t.reset();
jksoft 10:c52abd2d6595 33 t.start();
jksoft 10:c52abd2d6595 34 }
jksoft 10:c52abd2d6595 35
jksoft 10:c52abd2d6595 36 void countdown(int seconds)
jksoft 10:c52abd2d6595 37 {
jksoft 10:c52abd2d6595 38 countdown_ms((unsigned long)seconds * 1000L);
jksoft 10:c52abd2d6595 39 }
jksoft 10:c52abd2d6595 40
jksoft 10:c52abd2d6595 41 int left_ms()
jksoft 10:c52abd2d6595 42 {
jksoft 10:c52abd2d6595 43 return interval_end_ms - t.read_ms();
jksoft 10:c52abd2d6595 44 }
jksoft 10:c52abd2d6595 45
jksoft 10:c52abd2d6595 46 private:
jksoft 10:c52abd2d6595 47 OldTimer t;
jksoft 10:c52abd2d6595 48 unsigned long interval_end_ms;
jksoft 10:c52abd2d6595 49 };
jksoft 10:c52abd2d6595 50
jksoft 10:c52abd2d6595 51 #endif