Go to Post Oh, you know us...kicking puppies and stealing candy from babies and all. :rolleyes: - Travis Hoffman [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 22-11-2015, 10:19
Ragingenferno's Avatar
Ragingenferno Ragingenferno is offline
That one guy
AKA: Josh
FRC #3053 (Stingers)
Team Role: Programmer
 
Join Date: Feb 2014
Rookie Year: 2012
Location: NYC
Posts: 39
Ragingenferno is just really niceRagingenferno is just really niceRagingenferno is just really niceRagingenferno is just really niceRagingenferno is just really nice
Timing an LDR in C++

I'm so confused on this topic. I'm doing this for a arduino mega (pretty sure arduino is C++) What I'm trying to do is this: Read the value back from the LDR (Light Dependent Resistor) and start a timer for when the value is in a certain range and perform a function if the time recorded is a certain amount of time.

For example: I will have the LDR taped to a screen. SO when the screen is black (LDR value is about 120-150), it starts timing how long it was black for and keeps timing until the screen displays light (LDR 600 - 620). Hypothetically, lets say the screen was black for about 12000-12600ms, if the time recored falls between that, it does something but if its above 12600ms it does something else. (If, else statement)


However, all I know how to do is get the value of the LDR, I don't know anything else.

Can someone help me with the code for the timing function, I'm lost.

If someone can pleaseeeeeeee help that would be the best thing ever
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 22:34.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi