Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 2 of 2

Thread: Teensy 3.2 BLE Connection

  1. #1
    Junior Member
    Join Date
    Dec 2018

    Teensy 3.2 BLE Connection

    Hello! I have a project that involves a teensy 3.2 and a BLE HM-10 module.
    I actually need to wirelessly connect a myo armband to my teensy microcontroller through HM-10.

    I successfully connected the said components but it is through an Arduino UNO and not teensy. However, I need to use a teensy board and not an Arduino.

    Here is the code:

     * @file   printFirmwareInfo.ino
     * @author Valentin Roland (webmaster at
     * @date   September-October 2015
     * @brief  Example file demonstrating connecting to and reading data from the Myo.
     * This file is part of the MyoBridge Project. For more information, visit
     * @include printFirmwareInfo.ino
    #include <MyoBridge.h>
    #include <SoftwareSerial.h>
    //SoftwareSerial connection to MyoBridge
    SoftwareSerial bridgeSerial(2,3);
    //initialize MyoBridge object with software serial connection
    MyoBridge bridge(bridgeSerial);
    //a function to inform us about the current state and the progess of the connection to the Myo.
    void printConnectionStatus(MyoConnectionStatus status) {
    	//print the status constant as string
    void setup() {
      //initialize both serial connections
      while (!Serial) ;
      //wait until MyoBridge has found Myo and is connected. Make sure Myo is not connected to anything else and not in standby!
      Serial.println("Searching for Myo...");
      //initiate the connection with the status callback function
      Serial.print("Firmware Version: ");
      Serial.print("Hardware Revision: ");
      //declare a storage array for the hardware address
      byte address[6];
      //get the address and store it in our array
      //print the hardware address in HEX format
      Serial.print("Hardware Address: 0x");
      for (int i=0;i<6;i++) {
        Serial.print(address[i], HEX);
      //get the unlock pose
      MyoPose unlockPose;
      unlockPose = bridge.getUnlockPose();
      //print the name of the unlock pose as string
      Serial.print("Unlock Pose: ");
      //get the current battery level and print it
      byte batteryLevel = bridge.getBatteryLevel();
      Serial.print("Battery Level: ");
      //short vibration to show we are ready
    void loop() {
      //update the connection to MyoBridge

    In Arduino, I simply connected the TX Pin of HM-10 to Pin 2 of Arduino and connected the RX Pin of HM-10 to Pin 3 of Arduino.

    I did the same connections on my teensy board. But I had to add this part on the code "while (!Serial) ;" to display a text on the serial monitor.
    but its stuck on "Searching on myo…" but in Arduino it will display "connected"

    Through my research.. I think that it has something to do with SoftwareSerial but I'm not really sure. Also, maybe pin 2 and 3 are not the right pins to connect the Rx and Tx of the HM-10 when it comes to teensy 3.2??

    I'll really appreciate your help guys.
    Thank you so much!
    Last edited by oceanblue; 12-23-2018 at 08:10 AM. Reason: typographical error

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    IIRC softwareserial is not ideal for use on Teensy - but when used it has to be on actual Serial capable pins. Move wires and update code to use pins for Serial1 or 2 if softwareserial is really needed.

    Also the UNO can only present USB by having another onboard chip, which does not break PC connection during reprogramming. Where the Teensy itself has real USB hardware that is much more capable - but goes offline when the code is not running - like during an upload and restart and without while(!Serial) or while(!Serial && millis()<3000) the Teensy is up and running a couple hundred millis typically before the PC establishes the connection resulting in lost Serial output during that time.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts