Silly question I'm sure?

Status
Not open for further replies.

Mike2000

Member
Hi All,

Before I purchase the Teensy USB device... Can it support a single key pressed continuously i.e. 'T' without any software? I want to be able to boot up a Mac in Target disk mode from start up without any human touch, yeah I could just hack an old keyboard etc...

Any info would be most appreciated.

Regards,
Mike
 
Yes, it certainly can.

You might wish to have it repetitively send "T", perhaps something like this:

Code:
void loop() {
  Keyboard.print("T");
  delay(500);
}
 
Yes, it certainly can.

You might wish to have it repetitively send "T", perhaps something like this:

Code:
void loop() {
  Keyboard.print("T");
  delay(500);
}

Okay got the devices all okay thanks and tried compiling the above code with the following errors:

Can you tell what I'm doing wrong?

Many thanks.

------------------

make: *** [main.o] Error 1
mac1:firmware mike.thompsett$ make
avr-gcc -Wall -Os -DF_CPU=8000000 -mmcu=atmega8 -c main.c -o main.o
main.c: In function 'loop':
main.c:5:3: error: 'Keyboard' undeclared (first use in this function)
Keyboard.print("T");
^
main.c:5:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:6:3: warning: implicit declaration of function 'delay_ms' [-Wimplicit-function-declaration]
delay_ms(500);
^
make: *** [main.o] Error 1
mac1:firmware mike.thompsett$ make
avr-gcc -Wall -Os -DF_CPU=8000000 -mmcu=atmega8 -c main.c -o main.o
main.c: In function 'loop':
main.c:5:3: error: 'Keyboard' undeclared (first use in this function)
Keyboard.print("T");
^
main.c:5:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:6:3: warning: implicit declaration of function 'delay' [-Wimplicit-function-declaration]
delay(500);
^
make: *** [main.o] Error 1
 
Did you set the USB type under Tools to something that includes a keyboard instead of the default, which is Serial only?
 
There is an example called "simple.ino" in the menu options... Examples, teensy, USB_Keyboard, Simple ... of the IDE
 
Okay got the devices all okay thanks and tried compiling the above code with the following errors:

Can you tell what I'm doing wrong?

Many thanks.

------------------

make: *** [main.o] Error 1
mac1:firmware mike.thompsett$ make
avr-gcc -Wall -Os -DF_CPU=8000000 -mmcu=atmega8 -c main.c -o main.o
main.c: In function 'loop':
main.c:5:3: error: 'Keyboard' undeclared (first use in this function)
Keyboard.print("T");
^
main.c:5:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:6:3: warning: implicit declaration of function 'delay_ms' [-Wimplicit-function-declaration]
delay_ms(500);
^
make: *** [main.o] Error 1
mac1:firmware mike.thompsett$ make
avr-gcc -Wall -Os -DF_CPU=8000000 -mmcu=atmega8 -c main.c -o main.o
main.c: In function 'loop':
main.c:5:3: error: 'Keyboard' undeclared (first use in this function)
Keyboard.print("T");
^
main.c:5:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:6:3: warning: implicit declaration of function 'delay' [-Wimplicit-function-declaration]
delay(500);
^
make: *** [main.o] Error 1

what teensy are you using 2 or 3
you have to choose the right hardware.
 
Okay as I'm new to this it's a bit of a learning curve. Hardware is v3.1 Running on Mac with CrossPack-AVR-20131216 installed.

Sorry to be a pain, I'm sure once I have a bit more info this will be easy to complete.

Thanks for any help...
 
Well, that's probably your problem then. Teensy 3.1 is not an AVR processor, it's ARM based. Trying to compile Teensy 3.1 stuff for AVR probably isn't going to work, and even if you somehow got it to compile it wouldn't run on the chip.
 
In that case I will send it back for a re-fund, as this product doesn't work... tho Paul did say it would work.

Thanks anyway for all your help :(
 
It works just fine - and everything Paul has said in this thread is perfectly true. It's just not an AVR processor (you never mentioned that that was a requirement). The Teensy ++ 2.0 is AVR based, as is the regular 2.0 (AT901286USB and ATMEGA32U4 respectively). Coding for the 3.0/3.1 with the Teensyduino-modified Arduino application is very, very easy - especially if all you need it to do is send a single keypress.
 
I guess I'm not feeling the magic ref to the documentation, as it's just not clear enough for this newbee.

Thanks anyway for your help.
 
Mike2000, please try one more time. There really is a fast path for you here.

Start here: http://pjrc.com/teensy/td_download.html

Install the development tools. First you need to install Arduino. Then Teensyduino. Both are required.
Connect your Teensy 3 to your computer using a USB cable.
Select Tools > Board > Teensy 3.1 if it's not already selected.
Build the Blink example using the Arduino IDE with Teensduino installed. File > Examples > 01.Basics > Blink
Make the LED blink.
Change the rate that the LED blinks.
Open the File > Examples > Teensy > USB Keyboard
I believe this example does everything you want.
 
Hi Pictographer,

That makes things somewhat clear, tho following the instructions I'm now getting the following error...

"Keyboard only supported on the Arduino Leonardo"

Buttons.pde: In function 'void loop()':
Buttons:11: error: 'Keyboard' was not declared in this scope

I'm guessing I'm still missing something here.

Thank you for your help.
 
In the Tools > Boards menu, you need to select Teensy 3.1. It's probably defaulting to some other Arduino board. Setting that to Teensy 3.1 causes Arduino to create code that will work on Teensy 3.1. The software doesn't know which board you purchased, so this is where you tell it.

After that, in the Tools > USB Type menu, you need to select Kayboard+Mouse+Joystick. It probably defaults to Serial. When you get your program loaded onto Teensy, it will cause Teensy to become whatever type of USB device you select in that menu. If you want to use Keyboard.print() to send keystrokes, you must select one of the choices that has "Keboard".
 
Brilliant and all makes sense now and working, thank you all for your patiences on this topic.

Just one question left... is there away to hold the T key down continues without using loop/delay?

many thanks.
 
Quick update, found the command and now works perfectly. The Mac now boots up in target disk mode... Awesome.

Keyboard.press(KEY_T);

Many many thanks for all your help guys.
 
Hi Again,

Okay all working great, tho does anyone know how I can add or emulate the Mac keyboard? As the it only works if the keyboard in plugged in, I'm guessing it needs some sort of HID tag?

Many thanks for any help.
 
Status
Not open for further replies.
Back
Top