Last active
August 29, 2015 14:26
-
-
Save jorgemaia/32d05f9bb9b0952c4824 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <UIPEthernet.h> | |
#include <PubSubClient.h> | |
// Update these with values suitable for your network. | |
byte mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED }; | |
byte server[] = { 104,41,0,81}; | |
void callback(char* topic, byte* payload, unsigned int length) { | |
// Aqui trataremos o retorno que vier do servidor. | |
} | |
EthernetClient ethClient; | |
PubSubClient client(server, 1883, callback, ethClient); | |
void setup() | |
{ | |
Ethernet.begin(mac); | |
if (client.connect("arduinoClient")) { | |
client.publish("NOME_DO_TOPICO","UMA MENSAGEM...."); | |
client.subscribe("NOME_DO_TOPICO"); | |
} | |
} | |
void loop() | |
{ | |
client.loop(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment