Pages: [1]   Go Down
Author Topic: zoom control  (Read 386 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Sr. Member
****
Karma: 0
Posts: 252
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi all

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
Logged

Illinois, USA
Offline Offline
Full Member
***
Karma: 0
Posts: 126
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Steve
Logged

UK
Offline Offline
Shannon Member
****
Karma: 184
Posts: 11195
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 551
Posts: 46213
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
which makes me suspect this code may keep sending out commands repeatedly while the button remained pressed.
Why? The ! in there says to do something if the switch is not pressed. Presumably that something results in the switch becoming pressed.
Logged

UK
Offline Offline
Shannon Member
****
Karma: 184
Posts: 11195
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Pages: [1]   Go Up
Jump to: