element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum Screen text controlled by photoresistor
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Verified Answer
  • Replies 7 replies
  • Subscribers 391 subscribers
  • Views 476 views
  • Users 0 members are here
  • lcd
  • arduino
  • photoresistor
Related

Screen text controlled by photoresistor

pot82es
pot82es over 10 years ago

Hey!

 

Im building a mailbox, and i could really ned some help with a code. I need a text on the keypad library to change to another text on a 1602 LCD when the light is blocked by the photoresistor (if, else). Any kind of help is higly appriciated!

  • Sign in to reply
  • Cancel

Top Replies

  • neilk
    neilk over 10 years ago in reply to pot82es +3 verified
    pot82es Hi Kristoffer - surely you should be printing out the value of sensorValue that you are reading at: sensorValue = analogRead(analogPin); and do this at different light levels Neil
Parents
  • gadget.iom
    0 gadget.iom over 10 years ago

    Is your question related to this one?

    Arduino screen with photoresistor

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • pot82es
    0 pot82es over 10 years ago in reply to gadget.iom

    Yes! I didn't quite get i to work with the photoresistor...

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • pot82es
    0 pot82es over 10 years ago in reply to gadget.iom

    Yes! I didn't quite get i to work with the photoresistor...

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
  • clem57
    0 clem57 over 10 years ago in reply to pot82es

    Any output or observations to look at?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • pot82es
    0 pot82es over 10 years ago in reply to clem57

    I have the code...

     

    #include <LiquidCrystal.h>

    #include <LCDKeypad.h>

     

     

    LCDKeypad lcd;

     

    const int threshold = 600;

    const int analogPin = A0;

     

     

    int sensorMin = 1023;  // minimum sensor value

    int sensorMax = 0;     // maximum sensor value

    int sensorValue = 0;         // the sensor value

     

    void setup() {

     

      }

     

    void loop() {

     

    sensorValue = analogRead(analogPin);

     

      if (sensorValue > sensorMax)

      {

      lcd.begin(16, 2);

      lcd.print("POSTKASSE V.1.1");

      lcd.setCursor(0,1);

      lcd.print("Du har post!");

      }

      else

      {

      lcd.begin(16, 2);

      lcd.print("POSTKASSE V.1.1");

      lcd.setCursor(0,1);

      lcd.print("Du har ikke post");

      }

      delay(150);

    }

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • clem57
    0 clem57 over 10 years ago in reply to pot82es

    Ok, does any print occur and why is it not correct?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • pot82es
    0 pot82es over 10 years ago in reply to clem57

    The Photoresitor won't change anything  on the screen, thats what I need help for. I do not know the value to the anlog input or what code I should use for this.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • neilk
    0 neilk over 10 years ago in reply to pot82es

    pot82es Hi Kristoffer - surely you should be printing out the value of sensorValue that you are reading at:


    sensorValue = analogRead(analogPin);

     

    and do this at different light levels

     

    Neil

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Reject Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube