Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
arduino:lcd [2013/03/28 09:04] photonicsguyarduino:lcd [2014/11/13 10:50] (current) – external edit 127.0.0.1
Line 2: Line 2:
  
 ===== MJKDZ I2C board from eBay. ===== ===== MJKDZ I2C board from eBay. =====
- 
-  * [[http://www.ebay.ca/sch/i.html?_nkw=IIC+I2C+Serial+Interface+Board+Module+Arduino+LCD+1602+Display|eBay search for board]] 
 Notes: Notes:
-  * I2C address is actually 0x20, not 0x27+  * [[http://www.ebay.ca/sch/i.html?_nkw=IIC+I2C+Serial+Interface+Board+Module+Arduino+LCD+1602+Display|eBay search for board]] 
 +  *   * I2C address is actually 0x20, not 0x27
   * I'm using the [[https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home|New LiquidCrystal]] library   * I'm using the [[https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home|New LiquidCrystal]] library
   * Need pull-up resistors on SDA and SCL lines (A4 & A5 pins)   * Need pull-up resistors on SDA and SCL lines (A4 & A5 pins)
Line 13: Line 12:
  
 #define lcdAddr 0x20 // set the address of the I2C device the LCD is connected to #define lcdAddr 0x20 // set the address of the I2C device the LCD is connected to
- 
 // create an lcd instance with correct constructor for how the lcd is wired to the I2C chip // create an lcd instance with correct constructor for how the lcd is wired to the I2C chip
 LiquidCrystal_I2C lcd(lcdAddr, 4, 5, 6, 0, 1, 2, 3, 7, NEGATIVE); // addr, EN, RW, RS, D4, D5, D6, D7, Backlight, POLARITY LiquidCrystal_I2C lcd(lcdAddr, 4, 5, 6, 0, 1, 2, 3, 7, NEGATIVE); // addr, EN, RW, RS, D4, D5, D6, D7, Backlight, POLARITY
Line 19: Line 17:
 void setup() void setup()
 { {
-  lcd.begin(8,2);  // initialize the lcd as 20x4 (16,2 for 16x2)+  lcd.begin(16,2);  // initialize the lcd as 20x4 (16,2 for 16x2) 
 +  lcd.clear(); 
 +  //  lcd.home (); 
 +  //  lcd.print("123456789012345678"); 
 +  //  lcd.setCursor (0,1); 
 +  //  lcd.print("ABCDEFGHIJKLMNOP"); 
 + 
 +  lcd.setCursor (0,0); 
 +  lcd.print("Count:"); 
 +  lcd.setBacklight(1);
 } }
  
 +int i=0;
 void loop() void loop()
 { {
-  lcd.clear(); +  lcd.setCursor (7,0); 
-  delay(200); +  lcd.print(i++); 
-  lcd.home (); +  delay (100); 
-  lcd.print("12345678"); +
-  lcd.setCursor (0,2); +
-  lcd.print("ABCDEFGH"); +
-  delay (1800); +
-  +
 }</code> }</code>
 +
 +
 +Note: [[http://www.rpiblog.com/2012/07/interfacing-16x2-lcd-with-raspberry-pi.html|Code for Raspberry PI]]
 +
 +===== Special characters for the HD44780 =====
 +^Hex^Character^
 +|0xE4|micro|μ|
 +|0xF4|Ohm|Ω|
 +|0xDF|degree|º|
 +
  • arduino/lcd.1364486652.txt.gz
  • Last modified: 2014/11/13 10:50
  • (external edit)