Please if anyone could help I would be eternally grateful.
I am trying to get an Arduino to record the colour of the light and gps position as I move around - i have got both these things working - the trouble I am having is recording the results on a USB stick.
I am using the VDIP1 from http://www.vinculum.com/prd_vdip1.html.
I have connected the arduino to the VDIPs pins 6 and 8 (tried 4 and 5 too), and to a power supply.
I have tried the code from numerous tutorials and this forum, but nothing I do writes files to the USB stick - although the LEDs flash intermittantly on the VDIP.
Have I wired it up correctly? Can anyone give me a dummys guide to getting it going?
Many thanks.
Latest code follows:
#include "AFSoftSerial.h"
AFSoftSerial mySerial = AFSoftSerial(6, 8);
int fileNumber = 0;
void setup() {
pinMode(13, OUTPUT);
Serial.begin(9600);
// set the data rate for the SoftwareSerial port
Serial.println("initiating the VDIP");
mySerial.begin(9600);
mySerial.print("IPA"); // sets the vdip to use ascii numbers (so I can read them in the code easily!)
mySerial.print(13, BYTE); // return character to tell vdip its end of message
delay(10000); //10 seconds to init the disk before writing (some disks may take longer)
Serial.println("finished initiating the VDIP");
}
void loop() { // run over and over again
Serial.println("start loop");
if(fileNumber < 10){ //(mySerial.available()) {
//Serial.println("serial available");
mySerial.print("OPW LOG"); // open to write creates a file - named
mySerial.print(fileNumber); // LOG%1.TXT first time round - .TXT is for the computer
mySerial.print(".TXT"); // I have used the % sign in the name so I can search the disk for log files that it has created so as not to overwrite any that may be on already
mySerial.print(13, BYTE); // return character
delay(2000);
mySerial.print("WRF "); //write to file (file needs to have been opened to write first)
mySerial.print(6); //needs to then be told how many characters will be written
mySerial.print(13, BYTE); //return to say command is finished
mySerial.print("123456"); //followed by the info to write
mySerial.print(13, BYTE); //write a return to the contents of the file (so each entry appears on a new line)
delay(2000);
mySerial.print("CLF LOG"); // it closes the file
mySerial.print(fileNumber); // LOG%1.TXT
mySerial.print(".TXT");
mySerial.print(13, BYTE); // return character
Serial.println("wrote file "+fileNumber);
fileNumber++; //so we can create other files
delay(2000);
}else{
Serial.println("finished");
//Serial.println("serial unavailable");
//delay(1000);
}
}