So, after trying various solutions, I ordered few of these cheap hc-05.
I hooked up the transmitter to the Teensy in this way:
Teensy - HC05
3.3V out -> Vin
GND -> GND
RX1 -> TX
TX1 -> RX
This is the code that I use:
it turns on; I am able to pair it to my mac; and I can turn a led that I hooked up on pin 22. But there are issues:
1) I can communicate with it only when I have USB hooked up (I use a battery to power the Teensy without USB). I see that when I unplug the usb connection it does not work. I see no voltage on the TX or RX pin when I do so.
2) The module is on, but the light flicker like when it is pairing; the computer say that it is not paired; but I can turn the led on and off. I suspect that I am not using the HC05 at all.
3) I see in the Arduino app, that there are 3 couple of serial ports, beside /dev/tty.usbmodem284260 and /dev/cu.usbmodem284260:
/dev.tty.bluetooth-modem
/dev.cu.bluetooth-modem
/dev.tty.bluetooth-incoming-port
/dev.cu.bluetooth-incoming-port
/dev.tty.HC05-devB
/dev.cu.HC05-devB
Although, I cannot get any signal out of them, when I unplug the usb cable; the only one that works is the usbmodem one.
What am I doing wrong? I am trying to communicate with the Teensy+HC-05 without the USB cable (not to upload sketch; I am aware that Teensy cannot do that via serial Bluetooth). I am trying to send and receive AT commands to start with, but the idea is to send via console commands that will tun on LED.
I hooked up the transmitter to the Teensy in this way:
Teensy - HC05
3.3V out -> Vin
GND -> GND
RX1 -> TX
TX1 -> RX
This is the code that I use:
Code:
char INBYTE;
int LED = 22; // LED on pin 22
void setup() {
Serial.begin(9600);
pinMode(LED, OUTPUT);
}
void loop() {
Serial.println("Press 1 to turn Arduino pin 22 LED ON or 0 to turn it OFF:");
while (!Serial.available()); // stay here so long as COM port is empty
INBYTE = Serial.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);
}
it turns on; I am able to pair it to my mac; and I can turn a led that I hooked up on pin 22. But there are issues:
1) I can communicate with it only when I have USB hooked up (I use a battery to power the Teensy without USB). I see that when I unplug the usb connection it does not work. I see no voltage on the TX or RX pin when I do so.
2) The module is on, but the light flicker like when it is pairing; the computer say that it is not paired; but I can turn the led on and off. I suspect that I am not using the HC05 at all.
3) I see in the Arduino app, that there are 3 couple of serial ports, beside /dev/tty.usbmodem284260 and /dev/cu.usbmodem284260:
/dev.tty.bluetooth-modem
/dev.cu.bluetooth-modem
/dev.tty.bluetooth-incoming-port
/dev.cu.bluetooth-incoming-port
/dev.tty.HC05-devB
/dev.cu.HC05-devB
Although, I cannot get any signal out of them, when I unplug the usb cable; the only one that works is the usbmodem one.
What am I doing wrong? I am trying to communicate with the Teensy+HC-05 without the USB cable (not to upload sketch; I am aware that Teensy cannot do that via serial Bluetooth). I am trying to send and receive AT commands to start with, but the idea is to send via console commands that will tun on LED.