Page 1 of 1

Using Arduino Graphic LCD shield with Wifly-GSX

PostPosted: Sat Apr 28, 2012 7:02 pm
by que63
Hi all,

I am in a midst of a small project requiring sending 2 forms of data to graphical LCD. The first part which I have completed duly involves sending of textual data to the LCD via Wifly while the 2nd one deals with image files. I have set up a GUI for this purpose using Java.

Before getting myself involved in finding a way to read the image files, I tried to test whether it will be possible to send the image files (in form of an array of bytes) to the LCD. Luckily I was able to but the problem was that the image wasn't displayed correctly on the LCD. I tried type casting the spiSerial.read() but to no avail. Kindly advice on what could I be missing.

Here is the code:


CODE: SELECT_ALL_CODE
/*
  This program handles displaying of images received from the SpiUart terminal
  @author: A.Q.H
  @version 3.0  // modified for glcd 15.4.2012
 */

#include "WiFly.h" // We use this for the preinstantiated SpiSerial object.
#include "LCD4884.h"
#include "DFrobot_bmp.h"             // contains the image to be displayed for comparison purpose

void setup() {
 
  lcd.LCD_init();
  lcd.LCD_clear();
 
  SpiSerial.begin();
  //Serial.begin(9600);
}


void loop() {
 
  unsigned char image[256];

   if (SpiSerial.available() > 0) {
      lcd.LCD_clear();
     
 }

// get the incoming bytes of data
      while (SpiSerial.available() > 0)
      {
           for(int i=0; i<256; i++)
          {
               image[i]= SpiSerial.read();
          }   
      }
     
// display the DFrobot_bmp received from Wifly shield
     lcd.LCD_draw_bmp_pixel(0,0, image, 84,24);

// display same but hard coded image
     lcd.LCD_draw_bmp_pixel(2,3, DFrobot_bmp, 84,24);
     
}



The image that was received on the LCD is shown in the attachment while the expected one (which was hard coded into the program) is displayed under it. Sorry about the low quality image.

Thanks.

Re: Using Arduino Graphic LCD shield with Wifly-GSX

PostPosted: Sat Apr 28, 2012 11:10 pm
by yonghui
hi,

i think the received bytes from spi are incorrect.
have u try to verify that the send and receive through SPI correct?


regards,
yh

Re: Using Arduino Graphic LCD shield with Wifly-GSX

PostPosted: Sun Apr 29, 2012 10:55 am
by que63
yonghui WROTE:
have u try to verify that the send and receive through SPI correct?


I thought this was the problem so I checked the received bytes using tera term terminal and they were the same as the ones, no difference at all.

I have very limited image processing knowledge so I thought the problem could be on the above code.

Re: Using Arduino Graphic LCD shield with Wifly-GSX

PostPosted: Sun Apr 29, 2012 8:32 pm
by yonghui
hi,

try do this checking,

send an array of ascii characters, says, "ABcdefgHIJKLMN" from the transmitter to the receiver. the receiver store the received ascii array in a declared array. then LCD to display the received characters. see whether it is correct.


regards,
yh