Close

Coding...How do you start?

A project log for Toddler Door Monitor - Sleep Enforcer - Clock

A door monitor that goes one step further and shows toddlers when it is time to sleep or time to get up.

juniorJunior 03/04/2015 at 16:050 Comments

While waiting for my Spark Photon to arrive, I decided to code up using the Pro Mini as a stand in. I like to block out my code using comments, that way I can identify parts of code that need to exist and put them in the appropriate places. Not having any Formal schooling on code or code writing, I was just wondering if this is a "Thing"... comment coding, and if it's recommended, discouraged, etc. I know it works for me, but what do you PROs do?

////////////////////////Here there be loops////////////////////////
void loop() {
    //Check for user interaction
        //encoder button
            AdminLoop();
        //door reed switch
            //alert parents
    
    //Check for scheduled alarm status e.g. sleep time/wake time
        //ChronoDot holds 2 alarms and will pull SQW pin low when alarm times are reached
        
    //Check the time
    
    //update the 7seg display
    
    //update the Neopixel ring
    
}

void AdminLoop() {
    //Administrative actions loops
     //Loop to set time - Blue Encoder
    boolean blnSetTime=true;
    while (blnSetTime) {
            //Check for user interaction
                //encoder button
                blnSetTime=false;
                //encoder spin
            //update the 7seg display
            //update the Neopixel ring
        }
    //Loop to set go to sleep - Red Encoder
    //Loop to set wake up - Green Encoder
}

void Update7seg(String Time){
    //put stuff into the 7seg display
}

void UpdateNeopixel(int Color, int NumLeds){
    //paint up the Neopixel Ring
}

Discussions