I'm using the NativeEthernet.h library.
Found the following in the Forums. Thanks Guys!!
Serial Monitor says my IP is 0.0.0.0. When I look at my router/DHCP registrations, it has "unknown" for the hostname and 192.168.0.66 associated with the proper MAC address. I can also ping .66 from my local computer successfully.
How can I provide it a hostname so it can update my DNS? How can I return the proper IP address given to me by DHCP?
Thanks, Burt
Found the following in the Forums. Thanks Guys!!
Code:
byte mac[6];
void teensyMAC(uint8_t *mac) {
for(uint8_t by=0; by<2; by++) mac[by]=(HW_OCOTP_MAC1 >> ((1-by)*8)) & 0xFF;
for(uint8_t by=0; by<4; by++) mac[by+2]=(HW_OCOTP_MAC0 >> ((3-by)*8)) & 0xFF;
Serial.printf("MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
}
void setup() {
teensyMAC(mac);
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// Check for Ethernet hardware present
if (Ethernet.hardwareStatus() == EthernetNoHardware) {
Serial.println("Ethernet shield was not found. Sorry, can't run without hardware. :(");
} else if (Ethernet.linkStatus() == LinkOFF) {
Serial.println("Ethernet cable is not connected.");
}
// no point in carrying on, so do nothing forevermore:
Serial.println("Abnormal End...");
while (true) {
delay(1);
}
} else {
Serial.print("IP address: ");
Serial.println(Ethernet.localIP());
}
}
Serial Monitor says my IP is 0.0.0.0. When I look at my router/DHCP registrations, it has "unknown" for the hostname and 192.168.0.66 associated with the proper MAC address. I can also ping .66 from my local computer successfully.
How can I provide it a hostname so it can update my DNS? How can I return the proper IP address given to me by DHCP?
Thanks, Burt