Because many Arduinos (and Arduino clones such my favorite Teensy) can act as a keyboard, they can be programmed to output keystrokes (and mouse clicks) when a button is pushed. In this case a button is connected to ground and pin 2 on a Teensy that is running the following code (this is also available on GitHub).
Edit: The code on GitHub has been updated to allow two buttons using a Teensy or a Trinket, with the additional button for inputting the Wi-Fi passphrase. I've included a demo video of the new version at the bottom of this post.
String email = "example@example.com";
String password = "thisisaweakpassword";
const int enrolButton = 2;
#include <Bounce.h>
Bounce button1 = Bounce(enrolButton, 10); // 10 ms debouce
void setup() {
pinMode(enrolButton, INPUT_PULLUP);
}
void loop() {
button1.update();
if(button1.fallingEdge()) {enrol();} // call the enrol function
}
void enrol() {
Keyboard.begin();
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_ALT);
Keyboard.press('e');
delay(50); // wait for 50 milliseconds before releasing those keys
Keyboard.releaseAll();
delay(2000); // wait for 2 seconds to get the enrol screen
Keyboard.print(email);
Keyboard.press(KEY_TAB); //tab to get to the password field
delay(50);
Keyboard.releaseAll();
Keyboard.print(password);
Keyboard.press(KEY_ENTER);
delay(50);
Keyboard.releaseAll();
Keyboard.end();
}
When you hit the button connected to ground and pin 2, this will send the keystrokes Ctrl-Alt-e and your email and password for enrolling a Chromebook. You'll still manually connect to the Wi-Fi or LAN and click Accept on the licence agreement, but you could probably figure out how to automate that with a few more lines of code here (i.e. using KEY_TAB and KEY_SPACE).
Hopefully this will save you some typing and speed up the Chromebook enrolling process. Let me know if you try this.
6 comments:
Now that is awesome!
(I'd love to see a video of it in action, though).
I'll see if I can record a video next time I'm setting up some Chromebooks. It won't be a particularly exciting video, though, pushing the yellow button will make characters appear on the screen.
Wow, David this is something i had never considered, i mean this would work for various other applications that just Chrome books :)
This would certainly work on any computer for anything that requires input from a keyboard and/or mouse. Check out the documentation at http://arduino.cc/en/Reference/MouseKeyboard
WOW! This is awesome way to automate 30 seconds or less manual process.
clever!
Post a Comment