Skip to content

Commit 13aa4f4

Browse files
committed
update
1 parent 6bd89e8 commit 13aa4f4

File tree

1 file changed

+4
-54
lines changed

1 file changed

+4
-54
lines changed

README.md

Lines changed: 4 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -27,62 +27,12 @@ Here is a list of platforms that are supported:
2727
- [Arduino Yùn](https://www.arduino.cc/en/Main/ArduinoBoardYun)
2828
- [ESP8266](https://github.com/esp8266/Arduino)
2929

30-
## Example
30+
## Examples
3131

32-
- [Example using the alternative YunMQTTClient](https://github.com/256dpi/arduino-mqtt/blob/master/examples/YunMQTTClient/YunMQTTClient.ino).
32+
The examples show how you can use the library with your hardware:
3333

34-
```c++
35-
#include <Bridge.h>
36-
#include <YunClient.h>
37-
#include <MQTTClient.h>
38-
39-
YunClient net;
40-
MQTTClient client;
41-
42-
unsigned long lastMillis = 0;
43-
44-
void setup() {
45-
Bridge.begin();
46-
Serial.begin(9600);
47-
client.begin("broker.shiftr.io", net);
48-
49-
connect();
50-
}
51-
52-
void connect() {
53-
Serial.print("connecting...");
54-
while (!client.connect("arduino", "try", "try")) {
55-
Serial.print(".");
56-
}
57-
58-
Serial.println("\nconnected!");
59-
60-
client.subscribe("/example");
61-
// client.unsubscribe("/example");
62-
}
63-
64-
void loop() {
65-
client.loop();
66-
67-
if(!client.connected()) {
68-
connect();
69-
}
70-
71-
// publish a message roughly every second.
72-
if(millis() - lastMillis > 1000) {
73-
lastMillis = millis();
74-
client.publish("/hello", "world");
75-
}
76-
}
77-
78-
void messageReceived(String topic, String payload, char * bytes, unsigned int length) {
79-
Serial.print("incoming: ");
80-
Serial.print(topic);
81-
Serial.print(" - ");
82-
Serial.print(payload);
83-
Serial.println();
84-
}
85-
```
34+
- [ArduinoYun_MQTTClient](https://github.com/256dpi/arduino-mqtt/blob/master/examples/ArduinoYun_MQTTClient/ArduinoYun_MQTTClient.ino)
35+
- [ArduinoYun_YunMQTTClient](https://github.com/256dpi/arduino-mqtt/blob/master/examples/ArduinoYun_YunMQTTClient/ArduinoYun_YunMQTTClient.ino)
8636

8737
## API
8838

0 commit comments

Comments
 (0)