summaryrefslogtreecommitdiff
path: root/arduino/data_collect/data_collect.ino
blob: c8013b92a55402dbc9d4cd9698ef18142e281f2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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);
}