![]() Select the serial port for the Bluetooth device, and then select Tools -> Serial Monitor to see the serial console. On Windows, it will be the COM port name that was assigned when you paired the device. On OS X, there will be a new serial port listed called "HC-05". In the Arduino IDE, open Tools -> Serial Port. Open serial console using BluetoothĪfter uploading the sketch to your Arduino using its regular USB port, you need to switch the Arduino IDE's serial connection over to using the Bluetooth connection to receive the data sent by the sketch. This sketch is based on the "ASCIITable" example included in the Arduino IDE, but modified to use Software Serial on pins 2 and 3 and to repeat the table continuously. Select the usual serial port and board type for your Arduino, and upload the sketch via the Arduino's usual USB connection. SoftwareSerial bt(2,3) // RX, TX int thisByte = 33 īt. Open the Arduino IDE, and create a new sketch. Check our Bluetooth Pairing Guide for detailed instructions on OS X, Linux and Windows. You can now pair the Shield to your computer using PIN code 1234. The yellow "Status" LED on the Bluetooth shield should begin flashing rapidly, to show that it doesn't currently have a valid link. Then you can modify the example to get the behaviour you want.Ĭonnect your Arduino to your computer by USB to provide power. If you keep the jumpers in the positions shown in the photo above, and run the sketch example below, then everything will work. See below for an example.įind all this confusing? It can be! Don't worry too much for now. You have to use a "Software Serial" feature on the Arduino. This means you can't use commands like Serial.print(). D0 & D1 are the special pins which are connected to the USB/Serial interface on the Arduino. Pins D2 and D3 do not have hardware serial port features like pins D0 & D1. So Bluetooth TX connects to Arduino RX, and Bluetooth RX connects to Arduino TX. Remember that TX (transmit) and RX (receive) are from the Bluetooth Shield's point of view, opposite from the Arduino's point of view. The Arduino can transmit data via the Bluetooth shield using pin D3.
0 Comments
Leave a Reply. |