Library used during 1 day workshops presented by Skool and ARM Hungary in 2015.

Fork of Skool_wkshp_lib2015 by Laszlo Vagasi

pc_uart.cpp

Committer:
lvagasi
Date:
2015-10-01
Revision:
1:68d1a8c4970b
Parent:
0:3ad0af8abf43

File content as of revision 1:68d1a8c4970b:

#include "mbed.h"
#include "pc_uart.h"

Serial pc(SERIAL_TX, SERIAL_RX);    // UART to communicate with PC
DigitalOut myled(LED1);             // On-board LED

void Error(int err) {
    switch (err) {
        case 0: pc.printf("\033[44m\033[37mI2C communication error!\033[00m\r\n");
        break;
        case 1: pc.printf("\033[44m\033[37mIncorrect calibration data error!\033[00m\r\n");
        break;
        default: pc.printf("\033[44m\033[37mUnknown error!\033[00m\r\n");
        break;
    }
    while (1) {
        myled = 1;
        wait(0.1);
        myled = !myled;
        wait(0.1);
        myled = !myled;
        wait(0.1);
        myled = !myled;
        wait(2);
    }
}