Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <LiquidCrystal.h>
- LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
- unsigned long time;
- void setup() {
- Serial.begin(9600);
- }
- void loop() {
- //lcd.setCursor(0, 1);
- //lcd.print(millis()/1000);
- // read the input on analog pin 0:
- int sensorValue = analogRead(A0);
- // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
- float voltage = sensorValue * (5.0 / 1023.0);
- // print out the value you read:
- Serial.println(voltage);
- lcd.begin(16, 2);
- lcd.print("Voltage: ");
- lcd.print(voltage);
- lcd.setCursor(14,1);
- lcd.print("YP");
- lcd.setCursor(0,1);
- lcd.print("Time: ");
- lcd.setCursor(5,1);
- time = millis();
- //Serial.println(time/1000);
- lcd.println(time/1000); //prints time since program started
- delay(50); // wait a second so as not to send massive amounts of data- stops overload of lcd screen
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement