Skip to content

Instantly share code, notes, and snippets.

@fauberso
Last active September 28, 2019 11:19
Show Gist options
  • Save fauberso/305b3ac9829680d7ab5b19118599bcfe to your computer and use it in GitHub Desktop.
Save fauberso/305b3ac9829680d7ab5b19118599bcfe to your computer and use it in GitHub Desktop.
RaspberryPi-IgnitionKey
#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);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment