Pin IO is a way to control the digital inputs, outputs, and more on Circuit Playground wirelessly from a phone or tablet.  Right now only basic components like digital inputs, outputs, and even PWM (i.e. dimming an LED) are controllable with pin IO.

Pin IO works using the Firmata protocol to remotely control the Circuit Playground.  Normally Firmata is used with a USB or serial connection between an Arduino and a computer.  However by hooking up a Bluefruit LE module to the serial pins on Circuit Playground you can wirelessly talk the Firmata protocol to control Circuit Playground too.  You don't need to write any code to control the board--just load the Bluefruit LE Connect iOS or Android apps!

To use pin IO mode make sure you've followed all of the previous pages in this guide and have a Circuit Playground wired to a Bluefruit LE module, and the Arduino IDE setup to program both Circuit Playground and the Bluefruit LE module.

Next install the following Arduino library (use the library manager to find it, filter to BLEFirmata and install the Adafruit BLEFirmata library):

Once the library is installed open the CircuitPlayground_nRF51822 example from the library in Arduino.  This sketch implements the Firmata protocol and uses the Bluefruit LE module to listen for commands.

You don't need to make any modificiations to the sketch to use it, however if you changed the mode pin from 12 to something else you will need to modify the BLUEFRUIT_UART_MODE_PIN define in the BluefruitConfig.h tab.

Upload the sketch to Circuit Playground and you should be ready to start controlling the pins with either the Bluefruit LE Connect iOS app or Bluefruit LE Connect Android app.  If you haven't used the Bluefruit LE Connect app before be sure to skim the guide on its usage (although the guide is for iOS that application is very similar on Android).

Don't forget, make sure the Bluefruit LE module switch is in the DATA position!

circuit_playground_Screenshot_20160802-201631.png

Open the Bluefruit LE Connect application and look for a device called "BLE_Firmata".  Click the Connect button to connect to the Bluefruit LE module.

circuit_playground_Screenshot_20160802-201639.png

Click the Pin I/O button (on the iOS app look at the icons on the bottom of the screen) to enter Pin IO mode.

circuit_playground_Screenshot_20160802-201650.png

After entering Pin IO mode you should see a list of the digital inputs & outputs on Circuit Playground.

circuit_playground_Screenshot_20160802-201706.png

You can tap a pin to see options like turning it into an input and reading its state, or turning it into an output and setting it to a high or low logic level.

 

Try turning pin 13 into an output and toggling it high or low.  This pin is actually connected to the red LED on Circuit Playground and you should see it turn on/off as the pin toggles.

 

 Some of the components on Circuit Playground work just with digital IO and pin control:

  • The red LED on the board is pin 13 and can be turned on or off as a digital output.
  • The slide switch is pin 21 and will read a low level when on the right/+ and high level when on the left/-.
  • The left push button is pin 4 and right push button is pin 19, each will read a low level when not pressed and a high level when pressed.

Try pushing the buttons or moving the slide switch--you should see the pin state change in the Bluefruit LE Connect application.  That's all there is to the basics of controlling digital pins wirelessly with Bluefruit LE & Circuit Playground!

This guide was first published on Aug 03, 2016. It was last updated on Aug 03, 2016.

This page (Pin IO) was last updated on Oct 18, 2021.

Text editor powered by tinymce.