Troublshooting LCD shield

Hi, everyone, I'm truing to create a simple ibutton reader using LCD shield with the code below:

#include <LiquidCrystal.h>
#include <OneWire.h>

OneWire ibutton (2); // I button connected on PIN 2.

byte buffer[20]; //array to store the Ibutton ID.

//LCD pin to Arduino
const int pin_RS = 8; 
const int pin_EN = 9; 
const int pin_d4 = 4; 
const int pin_d5 = 5; 
const int pin_d6 = 6; 
const int pin_d7 = 7; 
const int pin_BL = 10; 
LiquidCrystal lcd( pin_RS,  pin_EN,  pin_d4,  pin_d5,  pin_d6,  pin_d7);
void setup() {
 lcd.begin(16, 2);
 lcd.setCursor(0,0);
 lcd.print("Waiting");
 lcd.setCursor(0,1);
// Serial.begin(9600); 
}
void loop() {
  lcd.setCursor(0,1);
  if (!ibutton.search (buffer)){//read attached ibutton and asign value to buffer
    ibutton.reset_search();
    delay(200);
    
    lcd.print("not found");
    return;
 }
 for (int x = 4; x>0; x--){  
    lcd.print(buffer[x],HEX); //print the buffer content in LSB. For MSB: for (int x = 8; x>0; x--) 
    
 }  
 lcd.print("     "); // print a space  
// int x;
// x = analogRead (0);
// lcd.setCursor(0,1);
// if (x < 60) {
//   lcd.print ("Right ");
// }
// else if (x < 200) {
//   lcd.print ("Up    ");
// }
// else if (x < 400){
//   lcd.print ("Down  ");
// }
// else if (x < 600){
//   lcd.print ("Left  ");
// }
// else if (x < 800){
//   lcd.print ("Select");
// }
} 

This works without LCD shield but when I install it I get gibberish in serial output!
thank you for any help

Please provide a link to the exact LCD shield being used.

1 Like

The code you have shown us does not do any serial output.
Show us the actual code you are running.

Also, are you sure that the yellow wire is connected to Arduino pin 2
And is the yellow wire soldered to the shield? You can just stick it in the hole.

--- bill

Remember that the OneWire bus requires a pull-up resistor. I think they recommend 4.7k Ohms.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.