|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#2
|
||||
|
||||
|
Re: Timing an LDR in C++
Hmm...
I don't know much about C++, but I would start by triggering a timer function when the sensor reads black, then when the sensor reads white, write the timer function's time to a variable then use that in an elif statement (excuse my python) something like: Code:
void main() {
if (sensor<black){
startTimer();
}
if (sensor == white && timerStarted == true){
if (timerValue<12600){
doSomething();
}
if (timerValue>12600){
doSomethingElse();
}
}
}
|
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|