squigley
Forum Replies Created
-
AuthorPosts
-
squigleyParticipant
Sounds like you have a short between the probes, or between the probes and the IC, or perhaps around the transistor and IC.
squigleyParticipantHey Joe,
It would be possible to completely remove the EthernetDHCP and EthernetDNS library requirement, I think, and with the changes I made, I’ve all but removed them.
Some variables need to be defined that are used, that are expected to be initialised by the inclusion of the above libraries.
After my above post about the “dirty” changes I made, I made some more changes, reprogrammed the device, and realised I had it checking the DHCP lease constantly.
I subsequently made some more changes, using millis() to only check the lease every hour, which could probably be increased more.
I made some large changes to the DHCPcheck function, replacing all the switch/case statements with the return codes from the new version.
I didn’t really want to post my code, since it’s pretty ugly, but in case there’s someone else with the same issue, I want to give them something to work with, so here goes..
// start Ethernet
//EthernetDHCP.begin(mac, true); // start ethernet DHCP in non-blocking polling mode
if (Ethernet.begin(mac) == 1) { // start ethernet DHCP in non-blocking polling mode
Serial.println("DHCP discovery success");
Serial.print("ip: ");
Serial.println(Ethernet.localIP());
ipState = DhcpStateLeased;
}
else {
while (Ethernet.begin(mac) == 0){
Serial.println("DHCP discovery failed");
delay(5000); // wait 5 seconds
}
}void loop() // main loop of the program
{
moistureCheck(); // check to see if moisture levels require Twittering out
wateringCheck(); // check to see if a watering event has occurred to report it
buttonCheck(); // check to see if the debugging button is pressed
analogWrite(COMMLED,0); // douse comm light if it was on
if (millis() % 3600000 == 0){
// an hour has passed
delay(2000);
dhcpCheck(); // check and update DHCP connection
}
if (millis() % 60000 == 0 && ipState != DhcpStateLeased && ipState != DhcpStateRenewing) {
blinkLED(COMMLED,1,30); // quick blnk of COMM led if there's no ip address
}
}// check and attempt to create a DHCP leased IP address
void dhcpCheck() {
//DhcpState prevState = ipState; // record the current state
//ipState = EthernetDHCP.poll(); // poll for an updated state
Serial.println("DHCP update..");
int State = Ethernet.maintain(); // poll for an updated state
//if (prevState != ipState) { // if this is a new state then report it
//switch (ipState) {
switch (State) {
//case DhcpStateDiscovering:
//Serial.println("DHCP disc");
//break;
//case DhcpStateRequesting:
//Serial.println("DHCP req");
//break;
//case DhcpStateRenewing:
//Serial.println("DHCP renew");
//break;
//case DhcpStateLeased:
case '0':
{
// 0: nothing happened
Serial.println("DHCP: nothing happened");
break;
}
case '1':
{
// 1: renew failed
Serial.println("DHCP: renew failed");
break;
}
case '2':
{
// 2: renew success
Serial.println("DHCP: renewed OK!");
// We have a DHCP lease, so print the info
Serial.print("ip: ");
Serial.println(Ethernet.localIP());
ipState = DhcpStateLeased;
//const byte* ipAddr = EthernetDHCP.ipAddress();
//const byte* gatewayAddr = EthernetDHCP.gatewayIpAddress();
//const byte* dnsAddr = EthernetDHCP.dnsIpAddress();
//Serial.print("ip: ");
//Serial.println(ip_to_str(ipAddr));
//Serial.print("gw: ");
//Serial.println(ip_to_str(gatewayAddr));
//Serial.print("dns: ");
//Serial.println(ip_to_str(dnsAddr));
break;
}
case '3':
{
// 3: rebind fail
Serial.println("DHCP: rebind failed");
break;
}
case '4':
{
// 4: rebind success
Serial.println("DHCP: rebind success");
// We have a DHCP lease, so print the info
Serial.print("ip: ");
Serial.println(Ethernet.localIP());
ipState = DhcpStateLeased;
break;
}
//}
}
}squigleyParticipantWow, this isn’t a very trivial change. I managed to hack a few changes in, to use Ethernet.begin and Ethernet.maintain instead, and got it working, but my changes were pretty dirty
in the main file under // start Ethernet I added:
Ethernet.begin(mac); // start ethernet DHCP in non-blocking polling mode
Serial.println(Ethernet.localIP());
ipState = DhcpStateLeased;in utility I had to make changes in the dhcpCheck function, adding
int State = Ethernet.maintain(); // poll for an updated state
and commenting out the check for a state change, and changing the switch to switch State, then adding case ‘2’ under DhcpStateLeased.
After that it worked, and it should keep it’s lease, but we’ll find out..
squigleyParticipantHi Drew,
Could I get some details on those changes? I’ve just hit the same issue. Running tcpdump on the interface the kit is attached to show it’s getting a lease, but when I try to do a test tweet, there’s no network activity at all.
I even tried hard coding the IP of the server in case it was a DNS issue, and then found this thread, so if you could let me know how I modify EthernetDHCP.cpp (or a different file?), to use the other syntax, it would be appreciated
June 17, 2012 at 6:48 pm in reply to: Errors compiling arduino software v1.01 + botanicalls 2 v3.01 #1879squigleyParticipantOk, I worked it out.
References to wiring.h and string.h within the “extern C” function need to be removed/commented out, and #include “Arduino.h” needs to be added above that, outside the function, in EthernetCompat.cpp, EthernetDNS.cpp and EthernetDHCP.cpp.
Then I was able to get it verify/compile.
June 17, 2012 at 6:35 pm in reply to: Errors compiling arduino software v1.01 + botanicalls 2 v3.01 #1878squigleyParticipantI’m getting the same issues. I changed the reference to wiring.h to Arduino.h, and removed the include of string.h (since changing it to Arduino.h seems redundant).
When I try to verify/compile, I get the following:
In file included from /home/squigley/Downloads/arduino-1.0.1/hardware/arduino/cores/arduino/Arduino.h:192,
from /home/squigley/Downloads/arduino-1.0.1/libraries/EthernetDHCP/EthernetDHCP.cpp:27:
/home/squigley/Downloads/arduino-1.0.1/hardware/arduino/cores/arduino/WString.h:116: error: declaration of C function ‘StringSumHelper& operator+(const StringSumHelper&, const char*)’ conflicts with
/home/squigley/Downloads/arduino-1.0.1/hardware/arduino/cores/arduino/WString.h:115: error: previous declaration ‘StringSumHelper& operator+(const StringSumHelper&, const String&)’ here
/home/squigley/Downloads/arduino-1.0.1/hardware/arduino/cores/arduino/WString.h:117: error: declaration of C function ‘StringSumHelper& operator+(const StringSumHelper&, char)’ conflicts with
/home/squigley/Downloads/arduino-1.0.1/hardware/arduino/cores/arduino/WString.h:116: error: previous declaration ‘StringSumHelper& operator+(const StringSumHelper&, const char*)’ here
/home/squigley/Downloads/arduino-1.0.1/hardware/arduino/cores/arduino/WString.h:118: error: declaration of C function ‘StringSumHelper& operator+(const StringSumHelper&, unsigned char)’ conflicts with
/home/squigley/Downloads/arduino-1.0.1/hardware/arduino/cores/arduino/WString.h:117: error: previous declaration ‘StringSumHelper& operator+(const StringSumHelper&, char)’ here
/home/squigley/Downloads/arduino-1.0.1/hardware/arduino/cores/arduino/WString.h:119: error: declaration of C function ‘StringSumHelper& operator+(const StringSumHelper&, int)’ conflicts with
/home/squigley/Downloads/arduino-1.0.1/hardware/arduino/cores/arduino/WString.h:118: error: previous declaration ‘StringSumHelper& operator+(const StringSumHelper&, unsigned char)’ here
/home/squigley/Downloads/arduino-1.0.1/hardware/arduino/cores/arduino/WString.h:120: error: declaration of C function ‘StringSumHelper& operator+(const StringSumHelper&, unsigned int)’ conflicts with
/home/squigley/Downloads/arduino-1.0.1/hardware/arduino/cores/arduino/WString.h:119: error: previous declaration ‘StringSumHelper& operator+(const StringSumHelper&, int)’ here
/home/squigley/Downloads/arduino-1.0.1/hardware/arduino/cores/arduino/WString.h:121: error: declaration of C function ‘StringSumHelper& operator+(const StringSumHelper&, long int)’ conflicts with
/home/squigley/Downloads/arduino-1.0.1/hardware/arduino/cores/arduino/WString.h:120: error: previous declaration ‘StringSumHelper& operator+(const StringSumHelper&, unsigned int)’ here
/home/squigley/Downloads/arduino-1.0.1/hardware/arduino/cores/arduino/WString.h:122: error: declaration of C function ‘StringSumHelper& operator+(const StringSumHelper&, long unsigned int)’ conflicts with
/home/squigley/Downloads/arduino-1.0.1/hardware/arduino/cores/arduino/WString.h:121: error: previous declaration ‘StringSumHelper& operator+(const StringSumHelper&, long int)’ here
In file included from /home/squigley/Downloads/arduino-1.0.1/libraries/EthernetDHCP/EthernetDHCP.cpp:27:
/home/squigley/Downloads/arduino-1.0.1/hardware/arduino/cores/arduino/Arduino.h:196: error: declaration of C function ‘uint16_t makeWord(byte, byte)’ conflicts with
/home/squigley/Downloads/arduino-1.0.1/hardware/arduino/cores/arduino/Arduino.h:195: error: previous declaration ‘uint16_t makeWord(uint16_t)’ here
/home/squigley/Downloads/arduino-1.0.1/hardware/arduino/cores/arduino/Arduino.h:206: error: declaration of C function ‘long int random(long int)’ conflicts with
/home/squigley/Downloads/arduino-1.0.1/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../avr/include/stdlib.h:504: error: previous declaration ‘long int random()’ here
/home/squigley/Downloads/arduino-1.0.1/hardware/arduino/cores/arduino/Arduino.h:207: error: declaration of C function ‘long int random(long int, long int)’ conflicts with
/home/squigley/Downloads/arduino-1.0.1/hardware/arduino/cores/arduino/Arduino.h:206: error: previous declaration ‘long int random(long int)’ here -
AuthorPosts
New kits are here!
Categories
- Announcements (8)
- Press (5)
Pothos Plant Tweets
Flickr Feed
www.flickr.com
|
Meta
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.