Arduino + ESP-01 1602 LED

Arduino + ESP-01 1602 LED

This page is to Setup and Config ESP-01 + 1602 LED

Hardware and Software

Hardware

Arduino + ESP 01

Software

Arduino IDE

// ESP8266 with 16x2 i2c LCD

// Compatible with the Arduino IDE 1.6.6

// Library https://github.com/agnunez/ESP8266-I2C-LCD1602

// Original Library https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library

// Modified for ESP8266 with GPIO0-SDA GPIO2-SCL and LCD1206 display

// edit library and change Wire.begin() by Wire.begin(sda,scl) or other GPIO's used for I2C

// and access from lcd.begin(sda,scl)

Example : http://ruten-proteus.blogspot.hk/2015/05/esp8266-esp-01-at023-sdk101.html

Sanki Notes

Examples

This example is Display on 1602 LED by ESP-01

Examples

Character Example -- Very Good

Examples - Position

Character Example -- Very Good

        1. // ESP8266 with 16x2 i2c LCD

        2. // Compatible with the Arduino IDE 1.6.6

        3. // Library https://github.com/agnunez/ESP8266-I2C-LCD1602

        4. // Original Library https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library

        5. // Modified for ESP8266 with GPIO0-SDA GPIO2-SCL and LCD1206 display

        6. // edit library and change Wire.begin() by Wire.begin(sda,scl) or other GPIO's used for I2C

        7. // and access from lcd.begin(sda,scl)

        8. /**

        9. * Displays text sent over the serial port (e.g. from the Serial Monitor) on

        10. * an attached LCD.

        11. */

        12. #include <Wire.h>

        13. #include <LiquidCrystal_I2C.h>

        14. // Set the LCD address to 0x27 for a 16 chars and 2 line display

        15. LiquidCrystal_I2C lcd(0x27, 16, 2);

        16. void setup()

        17. {

        18. lcd.begin(0,2);

        19. lcd.backlight();

        20. // Initialize the serial port at a speed of 9600 baud

        21. Serial.begin(9600);

        22. }

        23. void loop()

        24. // ESP8266 with 16x2 i2c LCD

        25. {

        26. // Compatible with the Arduino IDE 1.6.6

        27. // If characters arrived over the serial port...

        28. // Library https://github.com/agnunez/ESP8266-I2C-LCD1602

        29. if (Serial.available()) {

        30. // Original Library https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library

        31. // Wait a bit for the entire message to arrive

        32. // Modified for ESP8266 with GPIO0-SDA GPIO2-SCL and LCD1206 display

        33. delay(100);

        34. // edit library and change Wire.begin() by Wire.begin(sda,scl) or other GPIO's used for I2C

        35. // Clear the screen

        36. // and access from lcd.begin(sda,scl)

        37. lcd.clear();

        38. #include <Wire.h>

        39. // Write all characters received with the serial port to the LCD.

        40. #include <LiquidCrystal_I2C.h>

        41. while (Serial.available() > 0) {

        42. lcd.write(Serial.read());

        43. uint8_t bell[8] = {0x4, 0xe, 0xe, 0xe, 0x1f, 0x0, 0x4};

        44. }

        45. uint8_t note[8] = {0x2, 0x3, 0x2, 0xe, 0x1e, 0xc, 0x0};

        46. }

        47. uint8_t clock[8] = {0x0, 0xe, 0x15, 0x17, 0x11, 0xe, 0x0};

        48. }

        49. uint8_t heart[8] = {0x0, 0xa, 0x1f, 0x1f, 0xe, 0x4, 0x0};

        50. uint8_t duck[8] = {0x0, 0xc, 0x1d, 0xf, 0xf, 0x6, 0x0};

        51. uint8_t check[8] = {0x0, 0x1 ,0x3, 0x16, 0x1c, 0x8, 0x0};

        52. uint8_t cross[8] = {0x0, 0x1b, 0xe, 0x4, 0xe, 0x1b, 0x0};

        53. uint8_t retarrow[8] = { 0x1, 0x1, 0x5, 0x9, 0x1f, 0x8, 0x4};

        54. // Set the LCD address to 0x27 for a 16 chars and 2 line display

        55. LiquidCrystal_I2C lcd(0x27, 16, 2);

        56. void setup()

        57. {

        58. lcd.begin(0,2);

        59. lcd.backlight();

        60. lcd.createChar(0, bell);

        61. // ESP8266 with 16x2 i2c LCD

        62. lcd.createChar(1, note);

        63. // Compatible with the Arduino IDE 1.6.6

        64. lcd.createChar(2, clock);

        65. // Library https://github.com/agnunez/ESP8266-I2C-LCD1602

        66. lcd.createChar(3, heart);

        67. // Original Library https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library

        68. lcd.createChar(4, duck);

        69. // Modified for ESP8266 with GPIO0-SDA GPIO2-SCL and LCD1206 display

        70. lcd.createChar(5, check);

        71. // edit library and change Wire.begin() by Wire.begin(sda,scl) or other GPIO's used for I2C

        72. lcd.createChar(6, cross);

        73. // and access from lcd.begin(sda,scl)

        74. lcd.createChar(7, retarrow);

        75. lcd.home();

        76. #include <LiquidCrystal_I2C.h>

        77. #include <Wire.h>

        78. lcd.print("Hello world...");

        79. lcd.setCursor(0, 1);

        80. LiquidCrystal_I2C lcd(0x27,16,2); // Check I2C address of LCD, normally 0x27 or 0x3F

        81. lcd.print(" i ");

        82. lcd.write(3);

        83. uint8_t heart[8] = {0x0,0xa,0x1f,0x1f,0xe,0x4,0x0}; // example sprite bitmap

        84. lcd.print(" arduinos!");

        85. delay(5000);

        86. void setup() {

        87. displayKeyCodes();

        88. lcd.begin(0,2); // In ESP8266-01, SDA=0, SCL=2

        89. }

        90. lcd.backlight();

        91. lcd.createChar(1, heart);

        92. // display all keycodes

        93. }

        94. void displayKeyCodes(void) {

        95. uint8_t i = 0;

        96. void loop() {

        97. lcd.home(); // At column=0, row=0

        98. while (1) {

        99. lcd.print("ESP8266");

        100. lcd.clear();

        101. lcd.setCursor(0, 1);

        102. lcd.print("Codes 0x");

        103. lcd.print("LiquidCrystalI2C");

        104. lcd.print(i, HEX);

        105. delay(500);

        106. lcd.print("-0x");

        107. lcd.setCursor(10, 0); // At column=10, row=0

        108. lcd.print(i + 16, HEX);

        109. lcd.write(byte(1));

        110. lcd.setCursor(0, 1);

        111. delay(500);

        112. lcd.setCursor(10, 0); // At column=10, row=0

        113. for (int j = 0; j < 16; j++) {

        114. lcd.print(" "); // Wipe sprite

        115. lcd.write(i + j);

        116. }

        117. }

        118. i += 16;

        119. delay(4000);

        120. }

        121. }

        122. void loop()

        123. {

        124. // Do nothing here...

        125. }