งานปฏิบัติที่ 12
งานปฏิบัติที่ 12
wiring diagram
Code 1
Code 1
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
int aval,temp_aval=0;
void setup()
{
lcd.begin();
lcd.setCursor(0,0);
lcd.print("aval = ");
}
void loop()
{
aval = analogRead(A0);
if (temp_aval != aval)
{
lcd.setCursor(7,0);
lcd.print(" ");
}
lcd.setCursor(7,0);
lcd.print(aval);
temp_aval = aval;
delay(300);
}
Code 2
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
int aval,temp_aval=0;
void setup()
{
lcd.begin();
lcd.setCursor(0,0);
lcd.print("aval = ");
}
void loop()
{
aval = analogRead(A0);
if (temp_aval != aval)
{
lcd.setCursor(7,0);
lcd.print(" ");
}
lcd.setCursor(7,0);
lcd.print(aval);
if (aval>400)
{
lcd.setCursor(0,1);
lcd.print("Hi_Pattayatech");
}
else
{
lcd.setCursor(0,1);
lcd.print("-----");
}
temp_aval = aval;
delay(300);
}
ความคิดเห็น
แสดงความคิดเห็น