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).
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);
}
Thank you, I was not aware of the broken links, and I have no idea what the problem is. In the meantime, note.
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.
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.
Your PC software needs to look at the port where Bluetooth resides, not the port where the USB cable was.
If serial port is shared with USB, like Uno etc., disconnect Bluetooth while uploading.
Note the wiring in the pic below
The 1k/2k voltage divider resistors may not be strictly necessary, but are always a good idea.
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.