Truth be told there really isn't much to the sketch right now...
#include <Adafruit_CC3000.h>
#include <Adafruit_GPS.h>
#include <SD.h>
#include <SPI.h>
#include <string.h>
#include <SoftwareSerial.h>
#define WLAN_SSID "myNetwork"
#define WLAN_PASS "myPassword"
#define WLAN_SECURITY WLAN_SEC_WPA2
// Security can be the following;
// WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA, WLAN_SEC_WPA2
void setup()
{
Serial.begin(9600);
delay(2000);
Serial.println("Hello World");
delay(1000);
Serial.print("Initializing SD Card. Please Wait...");
pinMode(10, OUTPUT);
if (!SD.begin()) {
Serial.println("Card Failed, or not present...");
return;
}
Serial.println("Card was found");
}
void loop()
{
unsigned long TIME=millis()
if TIME%50==0{
int ref=analogRead(14);
float Vin=(1.1/ref)*1023;
float sensorU=(Vin/1023)*analogRead(0)*12-30;
float sensorV=(Vin/1023)*analogRead(1)*12-30;
float sensorW=(Vin/1023)*analogRead(2)*12-30;
float sensorQ=(Vin/1023)*analogRead(3)*.5*1000;
File dataFile = SD.open("datalog.txt",FILE_WRITE);
if (dataFile) {
dataFile.print(TIME);
dataFile.print(",");
dataFile.print(sensorU);
dataFile.print(",");
dataFile.print(sensorV);
dataFile.print(",");
dataFile.print(sensorW);
dataFile.print(",");
dataFile.println(sensorQ);
dataFile.close();
}
}
}
since I'm looking for a 20 hz sampling rate (a reading every 50 millis), if i could have an error of, at most 5 millis, I would be happy with that.
I would like a way to set millis()=0 using the gps. For example, I start it at 11:45 28.143. I would like for the arduino to wait until 11:50 to start collecting data. Since millis is an internal function, I dont believe I can overwrite it.