Example #1
0
int main() {
    Thread * thread;


    pc.baud(115200);

    pc.printf("\r\nStarting Mbed ...\r\n");
    //Initialize the LCD
    pc.printf("Initializing LCD ...\r\n");
    init_LCD();
    printf("Initializing USB Mass Storage ...\r\n");

    
    printf("Inititalizing ethernet ....\r\n");
    eth.init(); // Use DHCP
    eth.connect();
    printf("IP Address is %s\n", eth.getIPAddress());
    
    // After initializing the ethernet interface
    // run it in its own thread
    printf("Starting blinker thread ...\r\n");
    thread = new Thread(led1_thread);

    // Start the shell
    printf("Starting debug shell ...\r\n");
    shell.addCommand("ls", cmd_ls);
    shell.addCommand("load", cmd_load);
    shell.addCommand("mem", cmd_mem);
    shell.addCommand("sensor", cmd_sensor);
    shell.start(osPriorityNormal, SHELL_STACK_SIZ, shellStack);
    printf("Shell now running!\r\n");
    printf("Available Memory : %d\r\n", get_mem());
        
    // Do something logical here
    // other than looping
    while(1) {
        printf("Temperature : %d °C\r\n", htu21d.sample_ctemp());
        printf("Humitdity : %d%%\r\n", htu21d.sample_humid());
        wait(10);
    }
    
    thread->terminate();
    delete thread;
}