Output Devices
The assignment this week was to create an output device. I decided that I would like to create an output device capable of displaying text from an arduino. I had already configured an input device in the form of a temperature sensor that fed into my computer, so I figured it would be cool if I could link this input to an output.
I decided the best way to visualize this would be in the form of an LCD dislpay. I used a 16x2 display, with a built in Hitachi HD44780 driver. The Hitachi driver makes using an LCD much easier, because it can process higher level commands, and to some degree it standardsizes the way we talk to LCDs. I used the tutorial here to figure out how to hook up my LCD to my arduino. It was pretty straigtforward, tie the power and ground into the arduino's power and ground, and then attach the different pins on the LCD to specific pins on the arduino. The system uses a potentiometer to control the intensity of the LCD, so that you can dial in how it looks.
After I had hooked everything up, I plugged it into my laptop and then flashed the LCD helloworld example included in the arduino library to my board. The LCD flashed, but didn't show anything. I double checked all of my connections, but I was not able to figure out the problem. I figured it might be in the software.
The sketch calls for the pins to be connected to pins 12, 11, 5, 4, 3, and 2. All of these pins are digital pins except pin 2. I figured that maybe on a standard board pin 2 is digital, and this might be necesary for correct operation. I changed the conection from pin 2 to pin 6, which is digital, on thew board, and in the arduino IDE. I reflashed the board, and presto! It worked! The board correctly displayed "hello world" along with a counter for how long the board was on.
With proof that the LCD was working correctly, I could focus on getting the temp sensor to display on it. I hooked up the temperature sensor to the power, ground, and an input pin. I then took the initializing lines of code ffrom the hello world LCD example, and integrated them into the code that I used to get the temp senor to work. Then I used the lcd.print command to print the temperature in fahrenheit and celcius on the LCD.