diff options
author | Elena of Valhalla'' Grandi <valhalla@trueelena.org> | 2015-03-27 22:35:55 +0100 |
---|---|---|
committer | Elena of Valhalla'' Grandi <valhalla@trueelena.org> | 2015-03-27 22:35:55 +0100 |
commit | 4e7c4573108720d9c62b6f528b8ae910a750b4a9 (patch) | |
tree | 853ac8aed63738d087590cb6756c9c0087476999 | |
parent | e255aa8eed6977af633c93137d8a57ac8962eba8 (diff) |
Arduino sketch: send fixed messages via mqtt
-rw-r--r-- | arduino/data_collect/data_collect.ino | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/arduino/data_collect/data_collect.ino b/arduino/data_collect/data_collect.ino new file mode 100644 index 0000000..c8013b9 --- /dev/null +++ b/arduino/data_collect/data_collect.ino @@ -0,0 +1,25 @@ +#include <SPI.h> +#include <Ethernet.h> +#include <PubSubClient.h> + +#define TOPIC "data/here/temperature" + +byte mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED }; +byte server[] = { 192, 168, 1, 33 }; +byte ip[] = { 192, 168, 1, 72 }; + +EthernetClient ethClient; +PubSubClient client(server, 1883, 0, ethClient); + +void setup() { + Ethernet.begin(mac, ip); + +} + +void loop() { + client.loop(); + if (client.connect("arduinoClient")) { + client.publish(TOPIC,"12"); + } + delay(5000); +} |