countDecko

Untitled

Oct 8th, 2019
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Wire.h>
  2. #include <LiquidCrystal_I2C.h>
  3.  
  4. LiquidCrystal_I2C lcd(0x27,16,2);
  5.  
  6. const int sensor = A2;
  7.  
  8. void setup() {
  9.   // put your setup code here, to run once:
  10.   lcd.init();
  11.   lcd.backlight();
  12.   lcd.setCursor(0,0);
  13.   lcd.print("Initialize");
  14. }
  15.  
  16. void loop() {
  17.   if(analogRead(sensor) > 250){
  18.     lcd.clear();
  19.     lcd.print("ERRORRRR");
  20.   }
  21.   else{
  22.   double sensorValue = analogRead(sensor) * 0.05;
  23.   lcd.clear();
  24.   lcd.print(sensorValue);
  25.   }
  26.   delay(500);
  27. }
Advertisement
Add Comment
Please, Sign In to add comment