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

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

Committer:
jksoft
Date:
Thu Feb 09 07:26:57 2017 +0000
Revision:
0:0a2f634d3324
??

Who changed what in which revision?

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