Arduino + Async_Labs Wishield 1.0 + One-Wire DS18S20 - No network connection

(second times a Charm when posting. Oops. )

I have a problem with a sketch i am trying to write which uses an Arduino with an Async_Labs WiShield V1.0 (WiServer.h) and some DS18S20 OneWire Devices in Parasitic mode.

Each component works seperatly.
I can connect to the server with the Wisheild and upload my (bogus static) data to my webpage. (I can ping the Arduino from the server as well)
I can query the one wire bus and obtain appropriate readings from the DS18S20 devices.
These functions can both be done whilst the Arduino + WiSheild and OneWire devices are all plugged in.

When I combine the components together in the sketch, The WiSheild will not connect to the network (stops working) but I can still query my one wire devices.

(I thought this might be a power issue and so I have got the arduino plugged into a 9volt Wall Wart power supply)

if i comment out the code used to query the OneWire devices the WiShield connects as expected. Uncomment the code and the WiSheild Stops working.

I am using Pin 3 for the OneWire bus at the moment as the WiShield Skematic appears to show this not even connected (That is, its stright through the board) HOWEVER, I have tried pin 5 and 10 as well which both appears to be straight through pins. ( Pin 10 is the SPI interface which explains why things go pearshaped when I use THAT Pin but NOT when i use 3 or 5)

Atttached are two sketchs:

The first sketch should show the entire code uncommented.

The Second sketch should show the code that "works" with the onewire operations commented out.

I hope somebody can assist. This is driving me up the wall!

WifiandoneWire.ino (5.01 KB)

WifiandoneWire_commentedout.ino (5.1 KB)

    delay(1000);     // maybe 750ms is enough, maybe not

This line of code is killing the web server. You cannot use delay() while running the web server. Take a look at the blinkWithoutDelay example to see how you can remove the delay() from your code.

Thank you for your reply,

I have just tested this line of code delay(1000); by commenting it out in the sketch, and the networking still does not start.

I do not think the delay is causing the problem.

I originally had a 60 second delay which stopped everything, and many of the networking faqs say a delay will shut everything down compleatly so I removed it. I did consider this short delay as a problem but didnt think it would be a problem (hoped it would not)

There is something else in there :frowning:

Next problem: Change this part

    // Run WiServer
    WiServer.server_task();
  
  }

to

  }
  // Run WiServer
  WiServer.server_task();

You have to call the networking code often enough. You don't have an operating system on the Arduino which is handling all the low level stuff and allows multi-tasking by switching between tasks and threads but you have to take care for everything in your sketch. And leave the delay() from my first post removed, take care of that wait time by saving the time you requested the temperature reading and checking if the 750ms went over each time you're in the main loop.

Hello Pylon, Thank you for spotting that!

I moved WiServer.server_task(); outside of that loop and my code now works!

I DID however put the delay(1000); back in as it (or a similar timing feature) is needed for the parasitic power charging to the ds18s20 devices. I figured i would put the delay in and if it didnt work I could go to the slightly more complex time differential loop. This delay is short enough that the sketch still works as expected!

My problem is resolved! :slight_smile: Again, Thank you!