Advertisement
manvi_m

lcd with photoresistor

Jun 25th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. /*
  2. * Manvi Mittal
  3. * LCD with photoresistor
  4. */
  5.  
  6. #include <LiquidCrystal.h>
  7.  
  8. LiquidCrystal lcd (10, 19, 11, 12, 13, 7);
  9.  
  10. const int photoPin = A3;
  11. int photoVal = 0;
  12.  
  13. void setup() {
  14. // put your setup code here, to run once:
  15. lcd.begin (16, 2);
  16. lcd.print ("My name is");
  17. lcd.setCursor (12, 0);
  18. lcd.print ("...");
  19. delay (1000);
  20. lcd.setCursor (4, 1); // if you do not set your cursor, it will start at 0, 0
  21. lcd.print ("Manvi");
  22. delay (3000);
  23. lcd.clear ();
  24. }
  25.  
  26. void loop() {
  27. // put your main code here, to run repeatedly:
  28. photoVal = analogRead (photoPin);
  29. lcd.print ("The value is:");
  30. lcd.setCursor (6, 1);
  31. lcd.print (photoVal);
  32. delay (200);
  33. lcd.clear ();
  34.  
  35. // for (int i = 0; i <= 11; i++)
  36. // {
  37. // lcd.setCursor (i, 0);
  38. // lcd.print ("Manvi");
  39. // delay (500);
  40. // lcd.clear ();
  41. // }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement