Things used in this project

Hardware components:
Photon new
Particle Photon
×1
Adafruit industries ada592 image 75px
USB-A to Micro-USB Cable
×1
Software apps and online services:
Particle Build Online IDE

Schematics

Mandatory Fritzing sketch
Take your Particle and plug it into the Chromebook via USB.
Sorry, Fritzing didn't have 'USB-Cable' or 'Chromebook' in the parts list
Chromebookenrollment bb 7f7smyert1

Code

ChromebookEnrollmentArduino
Main file with the 3 steps of Enrollment
I created some convenience-functions like up, down, tab, enter in the KeyboardDuckie Library
// This #include statement was automatically added by the Particle IDE.
#include "KeyboardDuckie.h"


STARTUP(Keyboard.begin());
SYSTEM_MODE(SEMI_AUTOMATIC);


bool runChromebookStep0 = false;
bool runChromebookStep1 = true;
bool runChromebookStep2 = true;
bool runChromebookStep3 = true;

void Chrome_0_Chromebit_Setup(){
    delay_medium();
    tab();
    enter();
    tab();
}

void Chrome_1_WifiSetup(){
    
    delay_medium();
    
    tab(2);
    enter();
    delay_tiny();
    
    // Up 2 for Chromebooks & Chromebits
    up(2);
    
    // Up 3 for Chromeboxes because of Ethernet
    //up(3);
    delay_tiny();
    enter();
    delay_tiny();
    fastWrite("YOURSSID");
    tab();
    // Down 2 for WPA2
    down(2);
    tab();
    fastWrite("YOURWIFIPASSWORD");

    enter();
    
    // Delay(5000) for Chromebooks and Chromeboxes
    delay(5000);
    // Delay(10000) for Chromebits
    //delay(10000);
    
    tab();
    enter();
    
    runChromebookStep1 = false;
}

void Chrome_2_FirstSetup(){
    delay_short();
    enter();
    // Delay(5000) for Chromebooks and Chromeboxes
    delay(5000);
    // Delay(15 000) for Chromebits
    //delay(15000);
    runChromebookStep2 = false;
}

void Chrome_3_Enrollment(){
    delay_long();
    
    Keyboard.press(KEY_LEFTALT);
    Keyboard.press(KEY_LEFTCTRL);
    delay_tiny();
    Keyboard.press(KEY_E);
    
    Keyboard.releaseAll();
    
    //Keyboard.click(KEY_E, MOD_LEFTALT | MOD_LEFTCTRL);
    delay_long();
    //
    // Enrollment User EMail
    //
    fastWrite("USERNAME");
    
    //somehow I had problems just writing the @ so I used this workaround
    Keyboard.press(KEY_LEFTSHIFT);
    delay_tiny();
    Keyboard.press(KEY_2);
    Keyboard.releaseAll();
    fastWrite("DOMAIN");
    enter();
    delay_long();
    //
    // Enrollment User Password
    //
    fastWrite("YOURPASSWORD");
    //tab(2);
    enter();
    runChromebookStep3 = false;
}

// Stop the process when you press the System-button and
// try to connect to the cloud
void button_handler(system_event_t event, int duration, void* )
{
    if (!duration) { // just pressed
        RGB.control(true);
        RGB.color(255, 0, 0);
        runChromebookStep1 = false;
        runChromebookStep2 = false;
        runChromebookStep3 = false;
        Particle.connect();
        delay(1000);
        RGB.control(false);// MAGENTA
    }
        
}

///
//
//
// Finally - Run all the Stuff!
//
//
///

void setup() {
    
    System.on(button_status, button_handler);
    
    LedSetup();
    LedToggle();
}

void loop(){
    
    if(runChromebookStep0){
        Chrome_0_Chromebit_Setup();
    }
    if(runChromebookStep1){
        Chrome_1_WifiSetup();
    }
    if(runChromebookStep2){
        Chrome_2_FirstSetup();
    }
    if(runChromebookStep3){
        Chrome_3_Enrollment();      
    }
    
    //done with enrollment
    delay(100);
    LedToggle();
}
KeyboardDuckie.cppArduino
KeyboardDuckie 'Library' with some convenience-functions
#include "application.h"
#include "KeyboardDuckie.h"

int microdelay = 20;
int tinydelay = 100;
int shortdelay = 500;
int mediumdelay = 1000;
int longdelay = 2000;

void delay_micro(){
    delay(microdelay);
}

void delay_tiny(){
    delay(tinydelay);
}

void delay_short(){
    delay(shortdelay);
}

void delay_medium(){
    delay(mediumdelay);
}

void delay_long(){
    delay(longdelay);
}


void LedSetup(){
    pinMode(D7, OUTPUT);
}

bool led = true;

void LedToggle(){
    if(led == true){
        digitalWrite(D7, HIGH);
    }else{
        digitalWrite(D7, LOW);
    }
    led = !led;
}


void fastWrite(String text){
    Keyboard.releaseAll();
    for (unsigned int i = 0; i < strlen(text); i++) {
        Keyboard.write(text.charAt(i));
        //delay_tiny();
        LedToggle();
    }
}

void tab(){
    tab(1);
}

void tab(int count){
    while( count > 0){
        delay_tiny();
        Keyboard.click(KEY_TAB);
        count --;
        LedToggle();
    }
    delay(shortdelay);
}

void down(){
    down(1);
}

void down(int count){
    while( count > 0){
        delay_tiny();
        Keyboard.click(KEY_DOWN);
        count --;
        LedToggle();
    }
}

void up(){
    up(1);
}

void up(int count){
    while( count > 0){
        delay_tiny();
        Keyboard.click(KEY_UP);
        count --;
        LedToggle();
    }
}



void enter(){
    enter(1);
}

void enter(int count){
    while( count > 0){
        delay_short();
        Keyboard.click(KEY_ENTER);
        count --;
        LedToggle();
    }
    delay_short();
}

void shifttab(){
    shifttab(1);
}

void shifttab(int count){
    while( count > 0){
        delay_short();
        Keyboard.click(KEY_TAB, MOD_LEFTSHIFT);
        count --;
        LedToggle();
    }
    delay_short();
}
KeyboardDuckie.hArduino
Header-File for the KeyboardDuckie Lib
void LedSetup(void);
void LedToggle(void);

void fastWrite(String);

void delay_tiny(void);

void delay_short(void);

void delay_medium(void);

void delay_long(void);

void tab(int);
void tab(void);

void shifttab(int);
void shifttab(void);

void up(void);
void up(int);

void down(void);
void down(int);

void enter(int);
void enter(void);

Credits

Replications

Did you replicate this project? Share it!

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Weather Box
Easy
  • 2,114
  • 10

Full instructions

Small weather station that uploads to Weather Underground with a NeoPixel ring for visualization.

Washer/Dryer Monitor
Easy
  • 538
  • 5

Full instructions

Monitor your appliance's power indicator with a photocell for easy notifications without high voltage wiring.

Two Person Weasley Clock with Particle Photon and IFTTT
Easy
  • 1,010
  • 14

Full instructions

Taking inspiration from the Harry Potter character's Weasley clock, this one uses Particle and IFTTT to tell you where two people are.

Study Buddy
Easy
  • 2,532
  • 140

Full instructions

Know when an assignment is coming up!

Study Buddy

Team Alexa and Shannon

Security + 2.0 MyQ Garage Door Opener
Easy
  • 1,133
  • 4

Full instructions

Interface newer garage door openers with more than a relay.

Connecting Particle Photon with Twitter, Facebook or Mail
Easy
  • 646
  • 18

Full instructions

Whenever someone tweets you or sends a Facebook message or you receive a mail, a LED on Photon glows.

Add projectSign up / Login
Respect project