Go Down

Topic: Wifi shield garbling LCD shield (Read 514 times) previous topic - next topic

Gallifrey

Hi,

I have a SainSmart LCD Keypad Shield that I had working fine with a Leonardo on a project. I've added a wifi shield in between the LCD shield and the Leonardo. In order to not have the pins interfere with each other, I removed pins 4, 7 and 10 on the LCD shield and re-routed them to pins 1, 3 and A5. From what I can tell, after doing this, there are no pin conflicts.

So, here's the problem, if I write text the LCD keypad shield immediately after getting some data from the wifi board, a few characters of the LCD are scrambled. If I add just a 10 millisecond delay before writing to the LCD, it works fine. Other than that, both shields seem to work ok, though I haven't really fully tested the wifi shield by transferring data with the wifi shield since I want to solve this problem first.

Any ideas on what might be wrong? Thanks.

Here's some sample code where I added the 10 millisecond delays:

Code: [Select]
  // Start up wifi
  lcd.clear();
  lcd.print("Starting wifi");
 
  // check for the presence of the wifi shield:
  if (WiFi.status() == WL_NO_SHIELD) {
    lcd.clear();
    lcd.print("No Wifi Shield");
    // don't continue:
    while(true);
  }
 
  // attempt to connect to Wifi network:
  while ( status != WL_CONNECTED) {
    // Delay so the display isn't garbled.
    delay(10);
    lcd.clear();
    lcd.print("Wifi Connecting");
    // Connect to WPA/WPA2 network:   
    status = WiFi.begin(ssid, pass);

    // wait 10 seconds for connection:
    delay(10000);
  }
 
  lcd.clear();
  lcd.print("Connected");
  lcd.setCursor(0,1);
  ip = WiFi.localIP();
  // Delay so the display isn't garbled.
  delay(10);
  lcd.print(ip);


PaulS

Try over at http://snippets-r-us.com. The specialize in snippets. Here, we want to see ALL of your code, so that we can laugh at you connecting the LCD to the serial pins.

Gallifrey

I guess you're referring to pin 1? I thought that pin wasn't necessarily used as a serial pin on the Leonardo since the USB over serial is separated from pins 0 and 1. Is that not correct?

Gallifrey

I change the pin 4 rerouting so I'm using pin A4 rather than pin 1. No difference.

Go Up