#include <LiquidCrystal.h>
const int sensorPin = 0;
const int ledPin = 9;
int lightLevel, high = 0, low = 1023;
const int temperaturePin = 1;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
lcd.begin(16, 2);
//lcd.print("Hallo Welt");
pinMode(ledPin, OUTPUT);
}
void loop()
{
lcd.setCursor(0, 0);
float voltage, degreesC, degreesF;
degreesC = (voltage - 0.5) * 100.0;
degreesF = degreesC * (9.0/5.0) + 32.0;
analogRead(1);
//lcd.print("voltage: ");
//lcd.print(voltage);
//lcd.print(" deg C: ");
lcd.print(degreesC);
//lcd.print(" deg F: ");
//lcd.println(degreesF);
lcd.print ((char)223);
lcd.print("C");
delay(500);
lightLevel = analogRead(sensorPin);
manualTune();
analogWrite(ledPin, lightLevel);
}
void manualTune()
{
lightLevel = map(lightLevel, 0, 1023, 0, 255);
lightLevel = constrain(lightLevel, 0, 255);
}
float getVoltage(int pin)
{
return (analogRead(pin) * 1.004882814);
}
Lesezeichen