Well, I'm no programmer, I can tell you that, but I'm getting better. I have been struggling to get a LinkSprite TTL JPEG camera working and tonight I made SIGNIFICANT progress toward getting this seemly simply interface established. (I found a stupid error that I never would have expected that has caused my hair to gray considerably). Bygones be bygones, I am now getting data off this camera that looks (numerically) to be exactly what is expected to come from it and my task is now to write this pre-formatted jpeg compressed data to an SD card so I can load it onto my laptop and look at it. The data come to me in 42 byte packets from the camera, the first 5 bytes and the last 5 bytes are discarded and I need to write the middle 32 bytes to the SD card.I store this packet of data in a 42 byte array. I then loop though the middle 32 values of the array and write each byte to the SD card. When I do this and look at the file, the data has been written to the card as text; the values from the camera have been written to the card as individual numbers, not binary values. (the byte 255 is written to the card as the characters "2", "5" and "5", not FF). I have tried various ways to write the data to the card but I am always getting the same result. Code below... Thanks for your help.
#include <SoftwareSerial.h>
#include <SD.h>
...
dataFile = SD.open(charBuf, FILE_WRITE); // Open new file on SD Card
byte packet[42];
... take picture ...
... Read data out of camera into "packet" 42 bytes at a time ...
for ( i=5; i <37; i++) //read the image data out of the packet
{
// Write data to packet to SD card
if (dataFile)
{
dataFile.write(packet[i],BIN); This ends up writing to the SD card a text... :-(
}