How do I read on the basic atom with a bot board a simple button that has been closed. Wiring and programing wise. I have an idea but I want to make sure before I shorting things.
Go ahead and write some code and post it for us to look at. We always like to see what somebody has already tried to do so we don’t duplicate information. You may have already tried something we would suggest or we might have suggestions for improving it. This is a learn as you go experience.
The Bot Board 2 and the ABB before it have three buttons already on them. On the new board I believe they are connected to 13-15. You should look at the documentation for the board to verify which IO pins they are on. Assuming you have not removed the jumpers that control these pins, you can try out your programming to get this to work. For example if you wish to use IO pin 14, you could try something like:
input p14 ; tells the program that you will be using this pin for input
...
; Somewhere in your code you can tell the state of the button, by looking at the state of the pin like:
if P14 then
....
endif
Depending on how your button is wired the code would either detect if the button is pressed or if the button is not pressed. I will leave it to you to figure out which. Also a problem with buttons is that when they change state, they have a tendancy to change state several times until it settles. So you will probably need to add code to “Debounce” the button.
Also note, that the documentation for the board has a schematic that shows you at least one way to wire up additional buttons.