Hi , I'm korean student.
I'm working on my project that tft-LCD display saved-image from SDcard. But, In order to transfer data using the bluetooth
between arduino, I must use "Serial read/write". Is it so? But, "serial read/write" allowed only 1byte and RAW file is 2byte/1pixel.
So, I want to know how to transfer RAW data using the bluetooth and how to save RAW data to SDcard.
Please give me advise.??
void setup()
{
Serial.begin(9600);
Serial1.begin(9600); //hardware Serial use. //pin18,19
// Setup the LCD
myGLCD.InitLCD();
myGLCD.setFont(SmallFont);
myGLCD.fillScr(0, 0, 255);
if(!sd_raw_init())
{
Serial.println("MMC/SD initialization failed");
}
pinMode(SD_PIN, OUTPUT);
if (!SD.begin(SD_PIN)) {
ShowMessage("SD not ready");
return;
}
delay(10);
//root = SD.open("/PICTURE");
//WalkDirectory(root);
// ShowMessage("That's the end of the show", "Press RESET to start over");
}
void loop()
{
datafile= SD.open("log2.txt",FILE_WRITE);
int i=1;
if(Serial1.available())
{
while(Serial1.available()>0)
{
inbyte_char= Serial1.read();
Serial.print(inbyte_char);
if( (i%50)==0) { //cutting 50 row.
Serial.println("");
}
i++;
datafile.write(inbyte_char);
delay(1);
}
Serial.println("Read success!");
}
datafile.close();
//Serial.println("Read success!");
}