I just started playing with the Arduino, and I'm having a problem. I am trying to use the wire library to interface the HMC6352 compass module and the LiquidCrystal library to display results. I am also communicating over serial.
These three things (wire, LiquidCrystal and serial) sometimes give me random hangups and weirdness. The hangups always seem to occur at the wire.begin() line, but they only occur if all three components are used.
Sometimes, adding a simple line (like serial.println("a") somewhere in the sketch will suddenly cause everything to work.
The simplest sketch I can come up with that hangs is below. If I include the serial.println line, the sketch will run. If I comment it out, it doesn't run. Can someone try this out on their own arduino to check? Anybody know what's going on here?
I'm using Arduino 17 and an arduino nano.
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int ledPin = 13; // LED connected to digital pin 13
//Serial.println("a"); // uncommenting this line will cause sketch to run properly
digitalWrite(ledPin, HIGH); // check for quick blinky
delay(100); // to see if sketch runs