Bluetooth Pairing
The nw2s::b uses the bluetooth connection for two things.
1. Uploading new sketches (really it's firmware)
2. Issuing commands to the current sketch
The bluetooth module included with the nw2s::b is built by Adafruit and is very easy to set up and get running. It uses the SPP standard which most operating systems support with no additional drivers required. It's easy for applications to use as well as they just see the device as a plain ol' serial port.
I'll cover setting it up on OS X and Windows, but if you're adventurous, you'll be able to get something going on your Android phone or tablet. Unfortunately, iOS does not currently support the SPP protocol.
## OS X Pairing
The following sequence will get your nw2s::b paired with your OS X computer. Before you start, please close any applications that may be interested in knowing that you have a new serial port.
### Start the wizard
Open the system preferences and then open the Bluetooth panel. You'll see the following screen - or something like it.
Click on the '+' to open the wizard which will guide you through pairing.
### Select the Adafruit device
Your computer will scan for available devices and show any items that are not currently paired. If you have more than one nw2s::b, each of them will have a unique number. If you don't see it, make sure the device has power. If it has power and the LEDs are blinking on the bluetooth board, then make sure it's in pairing mode by clicking the 'Pair' button.
### Start the pairing process
Click on 'Continue' and the pairing process will start. It will take a few seconds.
### Finish
When it's done you will permanently have a new serial port on your computer. Note that the Bluetooth connection will only be active when there is an open serial connections. Some examples of when an active connection is open are when the IDE is uploading or when the IDE serial monitor window is open. It will appear disconnected at all other times.
### Configure IDE to support Bluetooth upload
If you are going to use the IDE to upload new sketches over Bluetooth, you'll need to add a new configuration to the boards.txt file. This is not absolutely necessary, but it help speed things up and makes the process a little more reliable.
1. Navigate to /Applications and find the 'Arduino' application
2. Right click and choose 'Show Package Contents'
3. Navigate to Contents/Resources/Java/hardware/arduino/sam
4. Open boards.txt in a text editor of your choice
5. Add the following lines to the END of the file
arduino_due_bt.name=Arduino Due (Bluetooth)
arduino_due_bt.vid.0=0x2341
arduino_due_bt.pid.1=0x003d
arduino_due_bt.upload.tool=bossac
arduino_due_bt.upload.protocol=sam-ba
arduino_due_bt.upload.maximum_size=524288
arduino_due_bt.upload.use_1200bps_touch=false
arduino_due_bt.upload.wait_for_upload_port=false
arduino_due_bt.upload.native_usb=false
arduino_due_bt.build.mcu=cortex-m3
arduino_due_bt.build.f_cpu=84000000L
arduino_due_bt.build.usb_product="Arduino Due"
arduino_due_bt.build.board=SAM_DUE
arduino_due_bt.build.core=arduino
arduino_due_bt.build.extra_flags=-D__SAM3X8E__ -mthumb {build.usb_flags}
arduino_due_bt.build.ldscript=linker_scripts/gcc/flash.ld
arduino_due_bt.build.variant=arduino_due_x
arduino_due_bt.build.variant_system_lib=libsam_sam3x8e_gcc_rel.a
arduino_due_bt.build.vid=0x2341
arduino_due_bt.build.pid=0x003e
## Windows
Coming Soon! I don't have any windows boxes hanging around at the moment.