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

Thread: Teensy LC and Bluetooth possible?

  1. #1
    Junior Member
    Join Date
    Nov 2020
    Posts
    3

    Teensy LC and Bluetooth possible?

    Hello Everyone! New to all this and very new to coding. My initial project was to activate a microswitch and that would push a button 3 times rapidly (coding). I plug in the LC into the computer and it sees it as a keyboard/mouse/joystick and when I activate the microswitch everything works fine in the controller properties window. PERFECT! But. . .now I'd like to see if I can get this to work via bluetooth. Is this possible? I see countless vids on connecting to a computer or phone but the computer/phone is controlling what the board does (i.e. turning on LEDs. .) . I want to keep what I have and just replace the cable with a bluetooth connection.

    I have no clue on what bluetooth device to buy or how to code for this. Any help on this or learning material would be fantastic as I'm lost.

  2. #2
    Hi @EagleEye,
    It's a little unclear to me what your project is - do you want to build a Bluetooth keyboard?

    J

  3. #3
    Junior Member
    Join Date
    Nov 2020
    Posts
    3
    No. I created a ejection handle for a game. I used a teensy to push a button (joybtn 1) three times when the micro switch is activated (game requires the button to be pushed 3 times). Just wondering if I can get rid of the cable and transfer that via Bluetooth.

  4. #4
    Hi,
    I don't know your project, so I really have no idea how this works? If you explain better, it's much easier to offer advice...
    From what you have written up until now, I'm guessing that you have:

    - A PC with a game
    - A Teensy LC plugged into the PC via a USB cable that is emulating a keyboard
    - A button connected to the Teensy

    Now you want to skip the wires to the Teensy. Is this correctly guessed? If so - this is one way to do this for a one-off https://www.instructables.com/Blueto...hutter-Button/
    If you want to use Teensy, you'll need two Bluetooth modules and set them up like this: https://www.youtube.com/watch?v=hyME1osgr7s

    J

  5. #5
    Junior Member
    Join Date
    Nov 2020
    Posts
    3
    Game is DCS and the action I want is to eject. This is done by pushing a button (any button that you want to use as you can change the button mapping in the game itself) that must be pulled 3 times rapidly.
    Code
    void setup() {
    pinMode(2, INPUT_PULLUP);
    }

    void loop() {
    if (digitalRead(2) == LOW)
    {
    Joystick.button(1, 1);
    delay(80);
    Joystick.button(1, 0);
    delay(80);
    Joystick.button(1, 1);
    delay(80);
    Joystick.button(1, 0);
    delay(80);
    Joystick.button(1, 1);
    delay(80);
    Joystick.button(1, 0);
    }
    }

    I setup the Teensy as a "Keyboard/Mouse/Joystick" in the Tools of Arduino 1.8.13 software.
    Physically I have a microswitch connected to the GND pin and #2 pin on the board. Computer sees this as a joystick that when I click the mircroswitch the Joystick button 1 (in computer) activates 3 times. One Teensy board and one button thats all. Small project.
    My computer has built-in Bluetooth already. Thought I can see if its possible to add a Bluetooth module and just connect the two without the cable ( I understand I'd have to supply power still but no issue there).

    I looked at the site for the Bluetooth Camera Phone Shutter. That could work! I would just have to figure out how to program the Teensy to output the signal to another pin. Then connect that pin like the website. That way the Teensy would see the microswitch pushed and click three times (code above) and send that pulse to the cut up wireless keyboard then send that to the game. Very possible.
    Now how to code Teensy to output to a pin instead of usb?????

Posting Permissions

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