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

Thread: Mouse/Keyboard Program - Controlled from Pi - Not a bread board

  1. #1
    Junior Member
    Join Date
    Jun 2019
    Posts
    3

    Mouse/Keyboard Program - Controlled from Pi - Not a bread board

    I'm researching how to create a Mouse/Keyboard controller using a Tenesey/Pi. This is my first real project past the examples I've done.

    I've been researching this and I've seen the examples where buttons and a joy stick is used as control on a bread board. However, this isn't what I'm looking to do because I would like send the key and mouse movement from the data on PI.

    Questions:
    Will I need Two Teensy's (One for Mouse and one for Keyboard)?
    Because the USB port will be used in the client machine as a HID - what options does the Teensy have to send the keys pressed from the PI?

    Thanks

  2. #2
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    4,901
    Sorry I am not sure what exactly you are asking.

    If I am understanding correctly, you somehow have an RPI that is connected to a Teensy, and you wish for the Teensy to plugged into another computer? and act like a Mouse/Keyboard to that computer?

    First question than would be how are you connecting the RPI to the Teensy? Through Serial port on RPI expansion connector? That is doable, I have done that in the past.


    You should be able to use one Teensy to act both as a Mouse and Keyboard. You can do that by choosing which Teensy you are using in the Tools->Board menu.

    You then can choose one of the USB types in the: Tools->USB Type menu which has both of them listed. I don't see any that only has those two, but you could try the Keyboard Mouse Joystick option.

    Then your code can control both of them on the Teensy. You sort of need to merge two of the example programs to do this.

    You then need to do all of the glue work to tie it together.

    Example what is it on the RPI that will be generating the mouse and keyboard events? Somehow you need to package up that data and send it over to the Teensy. Then on the Teensy side you need code to receive that data from the RPI and then setup to generate the mouse and keyboard events over the USB to the main host...

    Again hard to say much more without more clues on what you are wanting to do.

  3. #3
    Junior Member
    Join Date
    Jun 2019
    Posts
    3
    Thanks for the replay.

    Your correct on what I'm looking to do.

    Basically I want to send a string to the teensy and it type it on the computer. This is the same for the mouse where I'll say move x,y pixels.

    In this application, I'll always be tied to the teensy to tell it what to do - it just has to be listening for the commands.

    I've never used serial to send something like this. I picture it setting at a command line prompt with two possible commands that accepts the correct arguments. However, I don't think it works like that, correct?

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,171
    I'm still confused. Is Raspberry Pi "the computer", so we're talking about just 2 things (Teensy and Raspberry Pi) connected by a single USB cable?

    Or is "the computer" something like a regular PC or Mac, so we're talking about 3 things (Teensy and Raspberry Pi and a regular PC), with a USB cable between the PC and Teensy, and some other cable between the Teensy and Raspberry Pi?

    Both scenarios are possible. But advice about how to do each would differ...

  5. #5
    Junior Member
    Join Date
    Jun 2019
    Posts
    3
    Sorry, let me try to clear that up.

    The Client computer is where the teensy is plugged in via USB. The client computer is where the keys and mouse changes states.

    The PI is connected to the teensy via serial and will send the commands to the teensy. In turn, the teensy moves the mouse and keys on the client computer.

    I hope that helps - if it doesn't, I'll give it another go.

Posting Permissions

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