gftgtgtf
Fork of MQTT by
Diff: MQTTEthernet.h
- Revision:
- 47:d3feba7f242a
- Parent:
- 46:88f62eb29442
--- a/MQTTEthernet.h Mon Jun 29 02:07:13 2015 +0000
+++ b/MQTTEthernet.h Sat Oct 03 10:53:36 2015 +0000
@@ -7,10 +7,6 @@
#include "MQTTSocket.h"
-uint8_t mac_addr[6] = {0x00, 0x08, 0xDC, 0x00, 0x00, 0x00}; // your mac address
-const char * ip_addr = "???.???.???.???"; // your ip
-const char * gw_addr = "???.???.???.???"; // your gateway
-const char * snmask = "???.???.???.???"; // your subnetmask
class MQTTEthernet : public MQTTSocket
{
@@ -19,8 +15,27 @@
{
wait(1);
this->createSocket();
- eth.init(mac_addr,ip_addr,snmask,gw_addr); // Do not use DHCP! If you use DHCP use "eth.init(mac_addr);".
- eth.connect();
+ //eth.init(mac_addr,ip_addr,snmask,gw_addr); // Do not use DHCP! If you use DHCP use "eth.init(mac_addr);".
+ uint8_t mac_addr[6] = {0x00, 0x08, 0xDC, 0x32, 0x23, 0x42};
+
+ eth.init(mac_addr);
+
+ printf("Check Ethernet Link\r\n");
+ while(1) { //Wait link up
+ if(eth.link() == true)
+ break;
+ }
+ printf("Link up\r\n");
+
+ int ethErr = eth.connect();
+
+
+ if(ethErr < 0)
+ {
+ printf("Error %d in setup.\n", ethErr);
+ }
+ printf("Server IP Address is %s\r\n", eth.getIPAddress());
+
}
EthernetInterface& getEth()
