All is done with the next simple script that was available as a sample script in the library;
( File \ Examples \ DigisparkKeyboard \ Keyboard )
#include "DigiKeyboard.h"
void setup() {
// don't need to set anything up to use DigiKeyboard
}
void loop() {
// this is generally not necessary but with some older systems it seems to
// prevent missing the first character after a delay:
DigiKeyboard.sendKeyStroke(0);
// Type out this string letter by letter on the computer (assumes US-style
// keyboard)
DigiKeyboard.println("Hello Digispark!");
// It's better to use DigiKeyboard.delay() over the regular Arduino delay()
// if doing keyboard stuff because it keeps talking to the computer to make
// sure the computer knows the keyboard is alive and connected
DigiKeyboard.delay(5000);
}
After uploading the script the program starts so watch out where to put the cursor when uploading the script.
The Digispark USB reacts if it is a keyboard where the "Hello Digispark!" is typed over and over again (with a delay 5000 ).
Hello Digispark!
Hello Digispark!
Hello Digispark!
Hello Digispark!
An application could be reading some sensor data on the attiny85 and outputting it e.g. in a spreadsheet.
No comments:
Post a Comment