Go Down

Topic: Getting Bytecode off SD card (Read 889 times) previous topic - next topic

m0zjo

Hello all

I have been really impressed with the arduino so far
For one of  my projects I will be generating a Jpeg image and saving it onto an sd card
Is the Arduino able to read the RAW bytecode of the file as hex and then squirt it down a serial stream as ascii e.g. ED E5 65 54

I thought that as an arduino can decode a text file then therefore it can read the raw bytes
I am a newbie though so I may not be seeing the proper picture

I am using the arduino uno and the ladyada SD shield
Thanks for your time  :)

M0ZJO

lesto

yes, just feed data to your arduino slowly.
sei nuovo? non sai da dove partire? leggi qui: http://playground.arduino.cc/Italiano/Newbie

m0zjo

Hi Thanks for your reply

How do you mean "slowly"?
Is there a function which does this for me??

lesto

i don't know how much, there are some SDFat benchmark where you can find the maxvalue for your SD

and, yes, there are funcion to save byte to SD, but you have to read the input (another file, serial, i2c, etc...) and call the SD.h function.
sei nuovo? non sai da dove partire? leggi qui: http://playground.arduino.cc/Italiano/Newbie

m0zjo

I have been using the SD libs to read out text files (datalogging). I also want to read out from the SD card (somehow) a Jpeg file that can be redecoded by the pc.

I have tried using the standard file read function but the arduino interprets the Jpeg file as text. This then corrupts the file as it is transmitted down the serial stream and cant be decoded by the pc. Is there a way that I can bypass the SD lib text encoder and just get the raw bytes out of it? (Preferably in Hex)

m0zjo

Ok. I think that I have made some progress, I have replaced the Serial.write() function with serial.print(data,HEX). This is printing the file out in HEX. Still not sure weather I am getting non corrupt files though. I am using Hex Editor Neo to decode the files.

lesto

you are confused. binary, octal, decimal, hexadecimal, are different way to read the same data. it is ard to read 11111111 but it easy to read FF.
whan you use print you are writing the ASCII rapresentation if the binary value into anoter rapresentation.

Yoor coe with write was right, you just have to be sure to open the file (to write AND to read) as binary
sei nuovo? non sai da dove partire? leggi qui: http://playground.arduino.cc/Italiano/Newbie

Go Up