
steve.neal
I just want to confirm, so as to NOT release the magic smoke, I want to trigger scripts wit the press of a button or the closing of a normally open contact. I figure that I connect the Red (3.3 Volts) and White (signal) on an ADC port across the switching contacts and have a script watching the assigned ADC port for change. I also planned to connect a pull down resistor across the signal to ground to keep floating voltages in check.
Is the above correct?
Also I may need a little help with scripting, How do I wright a script to watch and wait until the contact is closed, or opened again for that matter? I need the script to pause the personality generator at least and then I can build on it from there.
Thanks for any help in advance
Steve
As for the code, an if/else statement will do:
Code:
Change the ADC port to the one you will be using. This should work.
Code:
Alan
Richard's script suggestion is a good way to do monitor the port to trigger a script. I may change some of my scripts to this method. However if you want the same switch to do multiple things like check and uncheck the personality generator then you need to be more creative. In this case I'll set a vearable of either on or off each time I push that button. With an if statement in a script I can check the status of that vearable and do different things like turn that control on and off. If you want, download my latest B9 project from the ez cloud and look at the first few scripts in the script manager. I can't offer the link right now. Sorry.
Pull Down Example (recommended for this application)
Pull Up Example (opposite of pull-down)
Dave, I did have a quick look at your projects, but I will need to spend more time to understand them. I am away on Holidays at the moment, (Port Douglas... beautiful spot in north Queensland), so I cant do anything practical until I get home. When I did have a look though, I couldn't seem to find the "Script Manager". It occurred to me after that there may be more than one page in your projects. When I get home I will have a "Women's look" instead of a "Mans look"
Thanks again everybody for your responses, I'm off to enjoy the beautiful Sun, beaches and girls in bikinis
Code:
Lots of stories to share but this is kinda off topic. Forgive me. Can't help it. I have to talk about my time with your people down under when I get a chance.
No need for apologies, go off topic any time you want. I scuba dived at the Great Barrier Reef too some years back, incredible springs to mind. Never slept on a beach under the stars though...sounds awesome
Catch ya soon mate
Steve
Returns the 8 Bit ADC value of the specified port
Example: $x = GetADC(adc0)
I am having trouble with the above as I cant seem to figure out how to nominate which EZB board I am using. I have 2 EZBs and I want to monitor Port 0 of Board 1.
I know the (adc0) refers to port 0 but how do I tell it to use board 1
Steve
So, for your example it would be
$x = GetADC(1.adc0)
Alan
Steve
yeah, I assumed he knew that board 1 is the second board because he specifically referenced it, and since I quoted the EZ-B manual section that explains the board numbering, but in case my assumption was wrong, yes, if you don't specify a number, it will choose board 0, the first board.
Alan
That "." instead of a "," made all the difference. This problem has been kicking my butt for nearly a day
Thanks again guys
Steve
It's all good Alan. I was the one who was confused. You knew exactly what you wanted to say.