Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "DigiKeyboard.h"
- // This sketch is used to do the initial setup on
- // a freshly installed Raspberry Pi: Upload it to a
- // Digispark board, and connect it to your Arduino.
- // It will log in using 'pi'/'raspberry' and execute
- // 'sudo systemctl enable ssh' and '...start ssh'
- const int def_delay = 125;
- void setup() {
- DigiKeyboard.delay(def_delay);
- DigiKeyboard.sendKeyStroke(KEY_ENTER);
- DigiKeyboard.delay(def_delay);
- type("pi");
- type("raspberry");
- DigiKeyboard.delay(10*def_delay);
- type("sudo systemctl enable ssh");
- type("sudo systemctl start ssh");
- DigiKeyboard.delay(5*def_delay);
- // Emit a 'beep' so we know we can remove the key
- // Connect headphones to hear it :)
- type("speaker-test -t sine -c 2 -s 2 -f 440");
- type("logout");
- }
- void loop() {
- }
- void type(char* text) {
- DigiKeyboard.println(text);
- DigiKeyboard.sendKeyStroke(KEY_ENTER);
- DigiKeyboard.delay(def_delay);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement