Teensy 3.0 Connect with BlueSMiRF

Status
Not open for further replies.
I had trouble hooking up a HC-05 bluetooth module to a Teensy 3 as well. It initially worked on an Arduino Uno, as described here:

http://www.instructables.com/id/Cheap-2-Way-Bluetooth-Connection-Between-Arduino-a/

I have a 5V bluetooth module, but the RX/TX is 3.3V. I verified this with a multimeter. I've connected RX/TX to ports 0/1 on the Teensy 3. I had to make some changes to the sketch provided in the link above. And this actually works for me:

Code:
char INBYTE;
int  LED = 13; // LED on pin 13

HardwareSerial bt = HardwareSerial();

void setup() {
  pinMode(LED, OUTPUT);
  
  bt.begin(9600);
  bt.println(); 
}

void loop() {
  bt.println("Press 1 to turn Arduino pin 13 LED ON or 0 to turn it OFF:");
  while (!bt.available());   // stay here so long as COM port is empty   
  INBYTE = bt.read();        // read next available byte
  if( INBYTE == '0' ) digitalWrite(LED, LOW);  // if it's a 0 (zero) tun LED off
  if( INBYTE == '1' ) digitalWrite(LED, HIGH); // if it's a 1 (one) turn LED on
  delay(50);
}
 
Last edited:
Status
Not open for further replies.
Back
Top