الكود :
#include <LiquidCrystal.h>
LiquidCrystal lcd(12,11,5,4,3,2);
int lightPin = A0;
void setup() {
// put your setup code here, to run once:
lcd.begin(16, 2);
lcd.print("Badr Ahmed");
delay(3000);
}
void loop() {
// put your main code here, to run repeatedly:
lcd.clear();
int lightReading = analogRead(lightPin);
int lightIntensity = map( lightReading, 1023 , 0 , 10 , 0 );
lcd.print("Light: /10 ");
lcd.setCursor(7, 0);
lcd.print(lightIntensity);
delay(50);
}
ليست هناك تعليقات:
إرسال تعليق