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

Well House Temperature Manager
Easy
  • 250
  • 6

Full instructions

Monitors the temperature of the well house to prevent the well from freezing.

Drink Alert!!! (Beverage Can Monitor)
Easy
  • 292
  • 4

Full instructions

Tired of going to grab a soda only to find they're all gone!? Well now you have an alert system to let you know when you need to refill.

The Food Thief Catcher
Easy
  • 127
  • 4

Work in progress

Are you tired of all of your pesky roommates stealing your food? Me too, thats why we have the Food Thief Catcher!

Happy Wife =  Happy Life
Easy
  • 233
  • 3

Full instructions

Wife not a morning person? Improve your life by improving your wife's temperament in the morning. Fresh coffee makes wife happy!

Happy Wife = Happy Life

Team We Are Not Coders

Temperature Sensor
Easy
  • 341
  • 5

Full instructions

A photon that measures the temperature and humididty with a DHT 22 sensor and communicates the temperature data to another photon.

Motion Activated Room Light
Easy
  • 138
  • 3

Full instructions

With this project, you'll never have to search for the light switch in the dark again.

Add projectSign up / Login
Respect project