Using Arduino Graphic LCD shield with Wifly-GSX

Talk about Arduino board, sheilds. Sharing Arduino projects, program, problems, solutions, suggestions..... many more, all are welcome.

Using Arduino Graphic LCD shield with Wifly-GSX

Postby que63 » Sat Apr 28, 2012 7:02 pm

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.
Attachments
IMG_20120428_190741.jpg
received image
que63
Freshie
 
Posts: 7
Joined: Sun Feb 26, 2012 6:36 pm

Re: Using Arduino Graphic LCD shield with Wifly-GSX

Postby yonghui » Sat Apr 28, 2012 11:10 pm

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
thanks&regards,
yh
yonghui
Moderator
 
Posts: 732
Joined: Mon Sep 28, 2009 3:27 pm

Re: Using Arduino Graphic LCD shield with Wifly-GSX

Postby que63 » Sun Apr 29, 2012 10:55 am

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.
que63
Freshie
 
Posts: 7
Joined: Sun Feb 26, 2012 6:36 pm

Re: Using Arduino Graphic LCD shield with Wifly-GSX

Postby yonghui » Sun Apr 29, 2012 8:32 pm

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
thanks&regards,
yh
yonghui
Moderator
 
Posts: 732
Joined: Mon Sep 28, 2009 3:27 pm


Return to Arduino Based

Who is online

Users browsing this forum: No registered users and 52 guests