The SODAQ Mbili board contains two columns of Grove connectors. The power to the first column can be switched on and off while the second column is always on. The pins for each socket are listed here and can also be found printed on the board.
Always On Column
Note: The switched column is off by default off.
The switched column allows for software control over the 3.3v line that powers that column of Grove sockets. Note that not all sensors or components require that the 3.3v line be powered in order to operate. For example, an LED connected to a Grove socket, will still function without power to the 3.3v pin. That is because the LED draws power from the I/O pin that it is connected to. However, a component like a button will not function as it draws power (when pressed) from the 3.3v pin and sends that power up through the I/O pin it is connected to.
The constant GROVEPWR specifies the digital pin (D22) which switches on and off the 3.3v power line to the switched Grove column. In order to switch that column on we must first initialise the GROVEPWR pin to OUTPUT mode:
Then we can switch that Grove column on and off by specifying the output of the GROVEPWRpin (HIGH = on).
digitalWrite(GROVEPWR, HIGH); digitalWrite(GROVEPWR, LOW);
Note: This also switches the red indicator LED in the bottom left corner of the board on and off.
Serial Connections using Grove
The TXD0/RDXD0 (3) are the same I/O lines that are connected to the USB port. These can be used instead of the USB port for purposes such as debugging. Connecting a USB port always causes a reset, this is by design. So if you want to disconnect and reconnect a debugging cable without interrupting the running program, you can use these I/O lines instead.
Additionally, the TXD1/RXD1 (9) are the same I/O lines that are connected to the Bee slot. So instead of using a bee style module these could be used to wire up a serial device on this grove connector.