Asked
— Edited
Can the EZ-B4 tell if a switch is on or off. If so can you show me an example code? Thanks
Intel Realsense T265
— T265 VSLAM for ARC: SLAM-based mapping and precise way-point navigation, low-power tracking, and NMS telemetry.
Try it →
no, the v4 doesn't have built in pull up or down resistors on the digital pins. you would have to supply one.
How would you accomplish this on an arduino? It would be the same for the V4. The arduino would have to measure the pin (d2 for example) for high or low. in order to do that, you would have to have a breadboard or some circuit that provides the 5V or 0V back to the arduino on the d2 pin. You would have to provide the pullup or pull down resistor in the circuit. You would have to provide positive and neg to the circuit or breadboard because there is no voltage coming across the solution you mentioned.
With a double pole single throw switch, you could take the digital signal pin from say D0, pass it through the switch and read the result on D1. Set D0 to high and then measure on D1. If the switch has been switched, D1 would be high. if it isnt, D1 would be low. This would be the easiest way to do what you are looking for.
This would work because there is a common ground between D0 and D1 (along with every other ground pin) on the V4.
Now I'm getting some where. Ok now I see how we are going to do this. Cool Thanks.
On The Arduino I use:
Anytime bud. You're basically doing the same thing with 2 digital pins.
Glad to have been of help.
The EZB4 cant read from the Signal pin to ground? I thought it had built in pull ups and pull downs.... ?
You will just have to use the signal pin. D0 to one side of the switch. D1 to the other side of the switch. The V4 has power to the other pins that is common (ground and +). You wont have to worry about these at all and no wires are needed at all on these pins (+ or -).
If you set D0 to on then d1 should read high or the other way around depending on which you want to do. I dont have one available to test with right now, but I will do a test tonight for you.
Your last code works well. Just put your switch from S signal to - or ground and the port will go 1 or 0 depending on how the switch is set.