Skip to content

Commit c69242d

Browse files
author
jenkie
committed
Bluetooth Setup for FC 2.0
1 parent ffa92bf commit c69242d

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

Bluetooth_Setup/Bluetooth_Setup.ino

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,37 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2424
*/
2525

2626

27+
#define HARDWARE_REV 20 //place your hardware revision here: 1-5 means hardware-revision 1.x, 2x means 2.x
28+
int SerialSpeed=9600; //set the current speed of your bluetooth module here, usually 9600
29+
30+
#if HARDWARE_REV<20
31+
HardwareSerial btSerial=Serial;
32+
int btPin=7;
33+
#else
34+
HardwareSerial btSerial=Serial1;
35+
int btPin=13;
36+
#endif
2737

2838
void setup()
2939
{
30-
Serial.begin(9600); //set the current speed of your bluetooth module here, usually 9600
31-
40+
btSerial.begin(SerialSpeed);
3241
delay(1000);
33-
pinMode(7, OUTPUT);
34-
digitalWrite(7,HIGH);
42+
pinMode(btPin, OUTPUT);
43+
digitalWrite(btPin,HIGH);
3544
delay(5000);
36-
Serial.print("AT");
45+
btSerial.print("AT");
3746
delay(5000);
38-
Serial.print("AT+VERSION");
47+
btSerial.print("AT+VERSION");
3948
delay(5000);
40-
Serial.print("AT+PIN1234"); // Set pin to 1234 or anything of your choice
49+
btSerial.print("AT+PIN1234"); // Set pin to 1234 or anything of your choice
4150
delay(5000);
42-
Serial.print("AT+NAMEArduinoPedelec"); //use your own name if you want
51+
btSerial.print("AT+NAMEArduinoPedelec"); //use your own name if you want
4352
delay(5000);
44-
Serial.print("AT+BAUD8"); // Set baudrate to 115200, do not change
53+
btSerial.print("AT+BAUD8"); // Set baudrate to 115200, do not change
4554
delay(5000);
46-
digitalWrite(7,LOW);
55+
digitalWrite(btPin,LOW);
4756
delay(10000);
48-
digitalWrite(7,HIGH);
57+
digitalWrite(btPin,HIGH);
4958
}
5059

5160
void loop()

0 commit comments

Comments
 (0)