Hi,
Using the datalogger example I can save data to the SD card.
Ultimately I want to be able to save wifi data received with a function such as this
wifiCheck.runShellCommand(F("iwlist wlan0 scan | grep ESSI"));
while (wifiCheck.available() > 0) {
char c = wifiCheck.read();
(c != ' ') {
Serial.print(c);
dataString += (c);
}
This works fine on it’s own, but when I try saving it to the SD card it works once or twice but then craps out and spits out garbage to the serial monitor.
Thinking this might be a memory or String issue I thought to save the data as a char instead of String but am not having much luck. Not real familiar with char.
Right now I’m trying to get the timestamp function to work using char instead of String .
What I’m getting back are numbers like 139 or 140.
Am I barking up the wrong tree or just not understanding char?
Thanks.
/*
7/14/15 testing using char instead of String
*/
#include <Process.h>
unsigned long previousMillis = 0;
unsigned long interval = 10000;
int firstPass = 0;
unsigned char Datastring;
void setup() {
Serial.begin(9600); // initialize serial communication
while (!Serial); // do nothing until the serial monitor is opened
Serial.println("Starting up...\n");
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
Bridge.begin(); // make contact with the linux processor
digitalWrite(13, HIGH); // Led on pin 13 turns on when the bridge is ready
}
void loop() {
unsigned long currentMillis = millis();
Process wifiCheck;
if (currentMillis - previousMillis >= interval || firstPass == 0) {
previousMillis = currentMillis;
getTimeStamp2();
}
}
String getTimeStamp2() {
unsigned char result2;
Process time;
time.begin("date");
time.addParameter("+%D-%T"); // parameters: D for the complete datemm/dd/yy
time.run(); // run the command
while (time.available() > 0) {
char c = time.read();
if (c != '\n')
result2 += c;
}
Serial.println(F("Result"));
Serial.println(result2);
result2=' ';
}