I was trying to have a script that would do some action when the action button on the RCP was pressed. It doesn't seem that I'm able to get the state of the action button. I tried just doing println(getButton()), but nothing showed up.
Also noticed that by default the action button starts and stops logging. Is there anyway to have the button do some other function and not control logging?
Can't Get Action Button State and Only Controls Logging?
Hi,
Right now the button it hard-wired to control logging, correct.
So you're saying 'println(getButton())' outputs nothing at all, or always 0?
Alternatively, you can wire a button to one of the GPIO inputs, with a pullup resistor to have an external button. Then, you can trigger some logic off of the GPIO state.
You'd wire it this way: one leg of the button to ground, the other to the input, tied with a pullup resistor (1K-100k)
Right now the button it hard-wired to control logging, correct.
So you're saying 'println(getButton())' outputs nothing at all, or always 0?
Alternatively, you can wire a button to one of the GPIO inputs, with a pullup resistor to have an external button. Then, you can trigger some logic off of the GPIO state.
You'd wire it this way: one leg of the button to ground, the other to the input, tied with a pullup resistor (1K-100k)
Code: Select all
5v or 12v pullup
|
resistor
|
Button ------- RCP GPIO input
|
|
|
Ground
I will play around with it more tomorrow and this weekend, but I get no 0s or 1s when trying println(getButton()). Debugging worked fine for the rest of the script.
The rest of my script worked though. I was originally going to make a timer for the driver to know how long they have been in the car for our Chump Car event. This would be reset by the button and an external battery pack would keep the RCP on when the kill switch turns off the main power. I don't want to accidentally stop logging by pressing the button, so I'll avoid that route.
I decided to just have the RCP turn off with the kill switch and then the timer resets when they turn it back on. Hopefully GPS lock comes back reliably and that works out. Right now I've formatted the timer to be "A.BCDE" where A is hours, BC is minutes, and DE is seconds since a string can't be output to a channel.
It will be our first race event with the RCP, so I'm excited to see how it performs. Worked like a charm in our test last weekend.
The rest of my script worked though. I was originally going to make a timer for the driver to know how long they have been in the car for our Chump Car event. This would be reset by the button and an external battery pack would keep the RCP on when the kill switch turns off the main power. I don't want to accidentally stop logging by pressing the button, so I'll avoid that route.
I decided to just have the RCP turn off with the kill switch and then the timer resets when they turn it back on. Hopefully GPS lock comes back reliably and that works out. Right now I've formatted the timer to be "A.BCDE" where A is hours, BC is minutes, and DE is seconds since a string can't be output to a channel.
It will be our first race event with the RCP, so I'm excited to see how it performs. Worked like a charm in our test last weekend.
Hi - great you're making progress!
To test the GPIO:
Make sure the config for that port is set to 'input' and then try this test, disconnecting the input from anything else:
* connect the input to the 5v reference and then run your script. you should see '1' as a result.
* connect the input ground. you should see '0' as a result.
To test the GPIO:
Make sure the config for that port is set to 'input' and then try this test, disconnecting the input from anything else:
* connect the input to the 5v reference and then run your script. you should see '1' as a result.
* connect the input ground. you should see '0' as a result.