Pages: [1]   Go Down
Author Topic: Getting Bytecode off SD card  (Read 834 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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  smiley

M0ZJO
Logged

0
Offline Offline
Shannon Member
****
Karma: 131
Posts: 10473
:(){:|:&};:
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

yes, just feed data to your arduino slowly.
Logged

sei nuovo? non sai da dove partire? leggi qui: http://playground.arduino.cc/Italiano/Newbie

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Thanks for your reply

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

0
Offline Offline
Shannon Member
****
Karma: 131
Posts: 10473
:(){:|:&};:
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

sei nuovo? non sai da dove partire? leggi qui: http://playground.arduino.cc/Italiano/Newbie

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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)
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Shannon Member
****
Karma: 131
Posts: 10473
:(){:|:&};:
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

sei nuovo? non sai da dove partire? leggi qui: http://playground.arduino.cc/Italiano/Newbie

Pages: [1]   Go Up
Jump to: