Connect Teensy 2.0 to PC using hc-06 bluetooth module.

Hello forum. I'm trying to connect my Teensy to the PC like the connection were via USB. I'm doing a musical instrument that works wirelesly. Then, the data is send to a software called Max MSP, where the sounds are given. I "only" need to make the USB connection "wireless" (the cable is annoying in this case).

Can you guide me throught the process?

Thank you

One_key.ino (644 Bytes)

  1. Please read how to use this forum, how to attache code. Your .ino-file does not download by some reason.
  2. Forum is not a tourist office giving guided tours here and there.

What is the difficulty? I guess You have some code. In that case, what does it do and what do You want it to do? Then helpers can step in.

Sorry Railroader, I attach the code again. The purpose is to emulate the USB connection via Bluetooth. When I press the key on my designed device, a MIDI message is send. With the USB cable all works perfectly (my computer recognice the Teensy device and the message), but I don't know what to do to make the same using the hc-06 and send the messages to the computer wirelessly. I think is something related to serial COM. BTW, my computer recognice the hc-06.

#include <Bounce.h>


const int channel = 1;


Bounce button0 = Bounce(0, 5); // va a leer del pin 16

void setup() {
 
  pinMode(0, INPUT_PULLUP);
  
}

void loop() {
  // Update all the buttons.  There should not be any long
  // delays in loop(), so this runs repetitively at a rate
  // faster than the buttons could be pressed and released.
  button0.update();
  
  
  if (button0.fallingEdge()) {
    usbMIDI.sendNoteOn(60, 99, channel);  
  }

   if (button0.risingEdge()) {
    usbMIDI.sendNoteOff(60, 0, channel);  
  }

 
  while (usbMIDI.read()) {
   
  }
    delay(8);                  

    
}

Why are you asking about the Teensy here????

Other than that you can program most of the newer ones using the Arduino IDE, they are not the same.

Ask at the Teensy forum.

Essentially Teensy + HC-06 via serial pins <--- Bluetooth ---> PC .

Fj___:
I "only" need to make the USB connection "wireless"

Assuming Teensy has serial Rx,Tx like Arduinos do:

  1. remove offending cable
  2. connect HC-06 to serial pins 0,1
  3. Do what is needed to be done at PC end
  4. play instrument or what ever as before

You might find the following background notes useful, but the above is about all there is to it.

http://homepages.ihug.com.au/~npyner/Arduino/GUIDE_2BT.pdf
http://homepages.ihug.com.au/~npyner/Arduino/BT_2_WAY.ino

ieee488:
Why are you asking about the Teensy here????

I use Arduino for programming :wink: .

Nick_Pyner:
Assuming Teensy has serial Rx,Tx like Arduinos do:

  1. remove offending cable
  2. connect HC-06 to serial pins 0,1
  3. Do what is needed to be done at PC end
  4. play instrument or what ever as before

You might find the following background notes useful, but the above is about all there is to it.

http://homepages.ihug.com.au/~npyner/Arduino/GUIDE_2BT.pdf
http://homepages.ihug.com.au/~npyner/Arduino/BT_2_WAY.ino

Thanks for the answer. I've just tried that. It doesn't work to me.

Btw, the links are broken, aren't them? :sob:.

Thank you, I was not aware of the broken links, and I have no idea what the problem is. In the meantime, note.

  1. the fact that PC can recognise HC-06 means no more than that. It does not mean it can get data from Arduino. That requires a proper connection between Arduino and HC-06.

  2. The code you have can be used unchanged PROVIDED the serial port shares the USB port like most Arduinos do, thereby having the same command serve both. If not, you need to change the

Serial.print(ladedah); // to terminal

command that you have now to whatever is necessary to send data to the serial output, pins 0,1. At a guess, this would be Serial1. If Teensy has extra hardware serial ports, use one of them and the same code change applies.

  1. Your PC software needs to look at the port where Bluetooth resides, not the port where the USB cable was.

  2. If serial port is shared with USB, like Uno etc., disconnect Bluetooth while uploading.

  3. Note the wiring in the pic below

Fritz.jpg

The 1k/2k voltage divider resistors may not be strictly necessary, but are always a good idea.

Fritz.jpg

Fj___:
I use Arduino for programming :wink: .

No, you use the Arduino IDE for programming.

The Teensy is different hardware. I have one. I know.

.

ieee488:
No, you use the Arduino IDE for programming.

The Teensy is different hardware. I have one. I know.

.

Exactly, that's more accurate.

Many thanks for the tips and explanation Nick_Pyner :slight_smile: .

Thanks. I now understand my link was broken by my ISP as part of the changeover to high speed broadband in Australia, and it will be fixed, soon. By that time, you probably won't need it.