I am not clear on the MD pin. Data sheet states that there are 20 I/O’s available, yet pin 20 (in blue on diagram) is labelled MD and its stated as “internally connected” to mode button. Does this means its hard wired or can it be decoupled from mode button and used as a general I/O?
The MD pin is hard wired to the MODE button and hence only of limited use.
The pin is by default pulled HIGH via a pull-up.
You can digitalRead(BTN)
to detect short button presses or you can use the MD pin to emulate a button press, but beyond that things may become tricky (depending on your intended use).
Just fishing for more I/O
Thanks!
Why don’t you use a GPIO expander - for example the MCP23008 run off the I2C bus will give 8 I/O and the MCP23017 16 I/O?
Great suggestion, this product I am working on is a fine balance between cost and features but it is certainly something I need to explore
Does this mean you can digitalWrite(MD, LOW);
and put the device in listening mode using your application without wiring anything up? What if you wanted to software exit listening mode if nothing connected in X amount of time? I’m interested in figuring out how far one can push the Device OS mode and reset buttons using the application code instead of physical buttons. Or would it just be better to connect MD to a separate digital pin with a pull-up and then pull it low to change modes?
I haven't tried it, but you'd also need to change the pinMode()
for it and that may have adverse effects on other device OS features (BTW, the pin designator is BTN not MD).
In order to enter Listening Mode you would not go that route.
You'd rather use WiFi.listen()
or Cellular.listen()
.
For that you would set the listening timeout or have your code run SYSTEM_THREAD(ENABLED)
, check the time living in LM and then issue Wifi.listen(false)
/ Cellular.listen(false)
.
Great! Just found those in the documents, this is exactly wanted I need.
Once the Particle is in the product I can't get access buttons or the USB, so I need software ways to access those features for field testing and troubleshooting for our tech's software.