Advertisement
diegopaulino

Mostrando % de luz -LCD

May 3rd, 2013
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <LiquidCrystal.h>
  2. LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
  3.  
  4.  
  5. void setup()
  6. {
  7.   lcd.begin(16, 2);
  8.     //Serial.begin(9600);
  9.  
  10. }
  11. void loop()
  12. {
  13.   lcd.setCursor(0, 1);
  14.   int val = analogRead(0);
  15.   val= (val*100)/1000;
  16.   lcd.print("LuzAmbiente:");
  17.   //Serial.println(val);
  18.   lcd.print(val);
  19.   lcd.print("%");
  20.   delay(2000);
  21.   lcd.clear();
  22.    
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement