Im going to make a LANC controller for a sony camcorder, the plan is to be able to control the zoom from an RC input,
I have a piece of code that reads the RC input and changes leds etc based on different thresholds, so im fairly sure its time to move on to the lanc part,
A quick google later and I have some code, assuming it works off the bat, which i can test later in the week. there are several lines that read
if (!digitalRead(recButton)) {
lancCommand(REC);
}
I assume that if i join my two codes, and just change the if statements then i should be able to get it up and running,
has anyone already tried this? maybe someone can save me a headache
I've not used the lanc library (I assume it is a library), but I'm pretty sure the IF statement is just saying "if it's not recording, start recording and if it is already recording, keep recording (do nothing)." You will need to include the lanc controller library or the function that defines lancCommand() and any other special instructions.
spruce_m00se:
there are several lines that read
if (!digitalRead(recButton)) {
lancCommand(REC);
}
That looks a bit dodgy - I don't see any logic to detect transitions between pressed/unpressed button states, which makes me suspect this code may keep sending out commands repeatedly while the button remained pressed.
PaulS:
Why? The ! in there says to do something if the switch is not pressed. Presumably that something results in the switch becoming pressed.
When you presume, you make an ... no, that doesn't quite work here. Maybe the code is right and the hardware setup is such that it has the intended effect. More likely IMO it's a coding bug. Either way, I think it would be worth checking.