Hi, I have an HC-05 Bluetooth module and a Teensy 3.2 wired like this:
Bluetooth Teensy
Tx -> Rx (pin 0)
Rx -> Tx (pin 1)
3.3v -> 3.3v
Gnd -> Gnd.
The HC-05 receives data but I can't get it in my sketch using pins 0/1. Here is the code:
The test sketch that sends data (from an arduino uno using bluetooth) is also very simple:
I am 100% sure that the HC-05 is working ok, i have tested it with a Leonardo and everything goes O.K.
The USB serial works perfectly, if i try to type something in the serial monitor I get:
But the UART on pins 0/1 seems totally unresponsive. I also tried to wire the leonardo TX to the teensy RX to bypass the bluetooth, but it didn't worked. I have tried to set the CPU speed to 24 and 96 mhz, and nothing changed. Is there something that I am missing here? Everything works nicely using Serial2 (pins 9/10) instead of Serial1 - pins 0/1.
Bluetooth Teensy
Tx -> Rx (pin 0)
Rx -> Tx (pin 1)
3.3v -> 3.3v
Gnd -> Gnd.
The HC-05 receives data but I can't get it in my sketch using pins 0/1. Here is the code:
Code:
#define HWSERIAL Serial1
void setup() {
Serial.begin(9600);
HWSERIAL.begin(9600);
while(!Serial);
while(!HWSERIAL);
Serial.print("Started!");
}
void loop() {
int incomingByte;
if (Serial.available() > 0) {
incomingByte = Serial.read();
Serial.print("USB received: ");
Serial.println(incomingByte, DEC);
// HWSERIAL.print("USB received:");
// HWSERIAL.println(incomingByte, DEC);
}
if (HWSERIAL.available() > 0) {
incomingByte = HWSERIAL.read();
Serial.print("UART received: ");
Serial.println(incomingByte, DEC);
HWSERIAL.print("UART received:");
HWSERIAL.println(incomingByte, DEC);
}
delay(100);
}
The test sketch that sends data (from an arduino uno using bluetooth) is also very simple:
Code:
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
int x =0;
void loop() {
// put your main code here, to run repeatedly:
Serial.println(0);
delay(400);
}
The USB serial works perfectly, if i try to type something in the serial monitor I get:
Code:
USB received: 119
USB received: 113
USB received: 13
USB received: 10
USB received: 97
USB received: 13
USB received: 10
But the UART on pins 0/1 seems totally unresponsive. I also tried to wire the leonardo TX to the teensy RX to bypass the bluetooth, but it didn't worked. I have tried to set the CPU speed to 24 and 96 mhz, and nothing changed. Is there something that I am missing here? Everything works nicely using Serial2 (pins 9/10) instead of Serial1 - pins 0/1.
Last edited: