คอมไพแล้วขึ้นแบบนี้ครับ โปรแกรม V 1.8.3 บอร์ด mega 2560 ต้องแก้ไขตรงไหนครับ ขอบคุณครับ
exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.
โคด
/* YourDuino.com Example Software Sketch
20 character 4 line I2C Display
terry@yourduino.com */
/*-----( Import needed libraries )-----*/
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
/*-----( Declare Constants )-----*/
/*-----( Declare objects )-----*/
// set the LCD address to 0x27 for a 20 chars 4 line display
LiquidCrystal_I2C lcd(0x27,20,4);
/*-----( Declare Variables )-----*/
void setup() /*----( SETUP: RUNS ONCE )----*/
{
Serial.begin(9600);
lcd.init(); // initialize the lcd
// Print our characters on the LCD
lcd.backlight(); //Backlight ON if under program control
lcd.setCursor(3,0); //Start at character 3 on line 0
lcd.print("Hello, world!");
delay(1000);
lcd.setCursor(2,1);
lcd.print("From YourDuino");
delay(1000);
lcd.setCursor(0,2);
lcd.print("20 by 4 Line Display");
delay(1000);
lcd.setCursor(0,3);
delay(1000);
lcd.print("http://YourDuino.com");
}/*--(end setup )---*/
void loop() /*----( LOOP: RUNS CONSTANTLY )----*/
{
{
// when characters arrive over the serial port...
if (Serial.available()) {
// wait a bit for the entire message to arrive
delay(100);
// clear the screen
lcd.clear();
// read all the available characters
while (Serial.available() > 0) {
// display each character to the LCD
lcd.write(Serial.read());
}
}
}
}/* --(end main loop )-- */
ยังคอมไพล์ไม่ผ่าน เช็คว่า ลงไลบารี lcd ถูกต้องแล้ว จุดนี้ครับ
/*-----( Import needed libraries )-----*/
#include
การต่อจอ lcd มีไลบารีหลายตัว
มีโคดตัวอย่างการใช้งานจอ lcd ที่หน้าเว็บ และหน้าบทความ
สาเหตุน่าจะเกิดจาก ต่อผิดขา scl ,sda ของ arduino mega ผิดไม่ใช่ A4 กับ A5
ตำแหน่งขาดังรูปครับ
ใช่ครับ ขา I2C ของ arduino mega ไม่ใช่ A4 กับ A5 ตามรูปภาพเลยครับ