Hi,
I'm lost finding a solution to what I try to achieve :
I want to read a temperature value from a file on my 1wire sort of nas station. I can get the value, but i can't trim the leading spaces from it.
I also want to repeat the reading of the whole file, which i can only achieve by resetting the arduino.
Anyone who can guide me into the right direction ?
The code :
#include <SPI.h>
#include <Ethernet.h>
#include <String.h>
byte mac[] = { 0xDE, 0xDE, 0xDE, 0xDE, 0xDE, 0x01 };
IPAddress ip(10,10,10,150);
byte server[] = { 10, 10, 10, 9 };
EthernetClient client;
void setup()
{
Ethernet.begin(mac, ip);
Serial.begin(9600);
Serial.println("starting simple arduino client test");
Serial.println();
Serial.println("connecting...");
if (client.connect(server, 80)) {
Serial.println("connected");
client.println("GET http://10.10.10.9/temperature");
client.println();
} else {
Serial.println("connection failed");
}
}
void loop()
{
if (client.available()) {
char temp = client.read();
Serial.print(temp);
}
if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
delay(2000);
void (*softReset) (void) = 0; //declare reset function @ address 0
softReset();
}
}
This is the output i get, the leading spaces are in the file, but I want to trim them away, how ??? Any other method to get the looping whithout resetting the arduino ? T
starting simple arduino client test
connecting...
connected
60.0625
disconnecting.
starting simple arduino client test
connecting...
connected
60.0625
disconnecting.