Programing the teensy

Status
Not open for further replies.

S&S Photobooth

New member
I am in the command prompt window & I need to program my teensy 2.0 to act as ctrl+k feature.

Can anyone help me with this?

Thanks
Shauna
 
I think you will likely need to vastly expand the information you have offered before anyone will be able to help you much.

What OS are you using? Have you installed the arduino IDE and teensyduino? etc.
 
I believe we talked on the phone earlier this morning?

Before attempting any of this stuff below, you'll need to get Arduino with Teensyduino up and running, so you can program code. It's best to start with File > Examples > 01.Basics > Blink. Once you can program your Teensy to blink at different speeds, then you're ready to begin the project.

The best example for you is File > Examples > Teensy > USB_Keyboard > Buttons.

As a first step, just program your Teensy with that code. You'll need to connect a pushbutton between the pin 0 and the GND pin. When you press the button, it just connects the 2 wires together. For testing, if you don't have the pushbutton, it's ok to just touch a paperclip to the GND and 0 pins. If you're in room where you might build up an electrostatic shock, touch the paperclip to the GND pin first, then to the signal pin.

With that example running, you should see "B0 press" typed to your computer when the paperclip touches both pins, and "B0 release" when you remove it. For testing, it's best to run another program like Notepad, so the typing doesn't change the code in Arduio.

This is the code which causes the typing:

Code:
  if (button0.fallingEdge()) {
    Keyboard.println("B0 press");
  }

To send a CLTR-K, try changing it to this:

Code:
  if (button0.fallingEdge()) {
    Keyboard.set_modifier(MODIFIERKEY_CTRL);
    Keyboard.send_now();
    Keyboard.set_key1(KEY_K);
    Keyboard.send_now();
    Keyboard.set_modifier(0);
    Keyboard.set_key1(0);
    Keyboard.send_now();
  }

Documentation about these functions is at this page:

http://www.pjrc.com/teensy/td_keyboard.html
 
Status
Not open for further replies.
Back
Top