
Rural Geek
I am putting bumper switches on the back of my bot. I am trying to save on Digital ports so my idea was to use resistors and acd input.
Here is a very crude drawing for the idea I am talking about. What I am wondering is if it will work as I think?
When a switch is closed the acd will read the resistor and I can use the software to figure out which switch is closed.
What do you think. I just want to make sure i don't let the factory smoke out the the EZ-B.
I'm thinking you would need to reduce the voltage, so some kind of voltage divider/reducer circuits after each switch.
That's how I would do it...
I haven't worked out if SW1 & SW2 closed, SW1 & SW3, SW2 & SW3 and SW1, SW2 & SW3. You may need to use different values if some I haven't worked out work out to the same. It's too late for me to think about the harder ones...
Now to the fun part coding and debug.
I'll put my code up in the script section when i get it done.
The script should be pretty straight forward to write and fun. But, and this may have just been my PC but when I run my voltage monitor script and have the visual ADC meters/graphs/values shown in the ARC environment it slowed my PC down a lot. Just the script running is perfectly fine though, so bear that in mind if you find your PC is slowing down.
That was one thing I was wondering is if you are using the adc in the script it doesn't mean that you have to have it running on the screen with a Read ADC? You can just use GetADC?
You may be better off using the ADC Value rather than ADC Graph (change the config, default is set to display volts), manually close each switch and check the reading, do it a few times in case there is any slight fluctuation (there shouldn't be but you never know).
Then use Ifs and Elseifs to make it do things depending on which switch is triggered (or depending on the ADC value to be more specific).
My IR Detection script shows how I looped and used the ADC value in IFs to do something if you get stuck. And my Battery Monitor script shows IFs and ELSEIFs to do different things depending on the values.
www.ez-robot.com/Community/Forum/posts.aspx?threadId=2582
DJ got back to me with this answer:
----_------------------------------
It's the communication channel. If you flood it by having too many requests, the software will suffer. If you are monitoring ADC and using ReadADC() in scripts, then you are executing twice as many communication calls, which affects performance twice as much.
Remember, when the GUI is running a "read" command from the EZ-B, it has to wait until the command is read and the value is returned. The process can only be as fast as the communication channel. You may use the Benchmark Control to view the communication performance on your computer.
To monitor the ADC, do not use a graphical ADC window - instead use the Variable Watcher to view the results of your ReadADC() commands.
-----------------------------------
In short, you can install all the monitors you want but pause them all using the check box. only run the ones you need and only when you need to.