Which header file to use to resolve "Keybord.print" and where to find it?

Status
Not open for further replies.

bengt

Member
My need is a generator to test a PC program with keyboard inputs.

I intend to use Teensy2 to simulate a keyboard via the USB connector of the
PC and have started to test the following, using Teensuduino:

//*****
int counter = 0;

void setup() {
Keyboard.begin();
}

void loop() {
counter++;
Keyboard.print("counter ");
Keyboard.print(counter);
Keyboard.print(" x ");
delay(2000);
}
//*****

...which generates "counter 2 x counter 3 x ..." until stopped.


The final test program is planned to be a Linux script, with some other
preparations/procedures for testing the PC, ending with Teensy2
test program compilation and loading. E. g:

# Bash script
.
.
.
avr-gcc -Wall -mmcu=atmega32u4 -O1 test-program.c -o test-program
avr-objcopy -j .text -j .data -O ihex test-program test-program.hex
teensy_loader_cli -mmcu=atmega32u4 -w test-program.hex
# End of bash script

However, compilation with "avr-gcc..." requires header file/s in test-program.c in order to resolve "Keyboard.print", which is not
required when Teensudino is used.

I have not succeeded in finding which header file/s I need and where to find it/them.

I kindly ask for advises.
 
The simplest way it to just use Arduino.

But if you really want to do things the hard way, all the code for USB keyboard on Teensy 2.0 is located in Arduino's hardware/teensy/avr/cores/usb_hid folder.
 
The simplest way it to just use Arduino.

But if you really want to do things the hard way, all the code for USB keyboard on Teensy 2.0 is located in Arduino's hardware/teensy/avr/cores/usb_hid folder.



My .../usb_hid folder contains the following files:

core_id.h
tmp.o
usb_api.cpp
usb_api.h
usb.c
usb_common.h error:
usb_private.h

However, "...error: ‘Keyboard’ undeclared..." is still reported even if I include all header files.

The IDE works, so the keyboard header file should be somewhere.

Can you give me some further hints please.
 
Status
Not open for further replies.
Back
Top