Saving data as char

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 =;
       (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?


  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;


  String getTimeStamp2() {
    unsigned char result2;
    Process time;
    time.addParameter("+%D-%T");  // parameters: D for the complete datemm/dd/yy;  // run the command

    while (time.available() > 0) {
      char c =;
      if (c != '\n')
        result2 += c;

    result2=' ';

Am I barking up the wrong tree or just not understanding char?


you likely want to use
** **date +%s** **
instead as the math will be much easier. %s will be give you seconds since 1970-01-01 00:00:00 UTC

Your output will look like this:

jessem@lenni:~$ date +%s


Thanks, I'll try that.