Example ARM Mbed client for connecting to the thinger.io platform.
Dependencies: ThingerEthernetClient mbed
main.cpp@1:eaf1cc124052, 2015-12-28 (annotated)
- Committer:
- alvarolb
- Date:
- Mon Dec 28 13:09:18 2015 +0000
- Revision:
- 1:eaf1cc124052
- Parent:
- 0:3da5c7b671dd
fix
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
alvarolb | 0:3da5c7b671dd | 1 | #include "mbed.h" |
alvarolb | 0:3da5c7b671dd | 2 | #include "ThingerEthernetClient.h" |
alvarolb | 0:3da5c7b671dd | 3 | |
alvarolb | 0:3da5c7b671dd | 4 | DigitalOut redLed(LED1); |
alvarolb | 0:3da5c7b671dd | 5 | |
alvarolb | 0:3da5c7b671dd | 6 | void redLedCallback(pson& in){ |
alvarolb | 0:3da5c7b671dd | 7 | redLed = in ? 0 : 1; |
alvarolb | 0:3da5c7b671dd | 8 | } |
alvarolb | 0:3da5c7b671dd | 9 | |
alvarolb | 0:3da5c7b671dd | 10 | int main() { |
alvarolb | 1:eaf1cc124052 | 11 | ThingerEthernetClient thing("username", "device_id", "device_credential"); |
alvarolb | 0:3da5c7b671dd | 12 | |
alvarolb | 0:3da5c7b671dd | 13 | thing["red_led"].set_input(redLedCallback); |
alvarolb | 0:3da5c7b671dd | 14 | |
alvarolb | 0:3da5c7b671dd | 15 | while(true){ |
alvarolb | 0:3da5c7b671dd | 16 | thing.handle(); |
alvarolb | 0:3da5c7b671dd | 17 | } |
alvarolb | 0:3da5c7b671dd | 18 | } |