Blink LED example for the Multitech mDot. Additionally, has serial comms via USB and RS232.

Fork of mbed-os-example-mbed5-blinky by mbed-os-examples

Blinks 1 LED while keeping another 2 on. LEDs are on the MTUDK2-ST-MDOT Developer Kit. Has USB and RS232 serial comms.

main.cpp

Committer:
Timsek
Date:
2017-06-12
Revision:
32:7c921089af60
Parent:
31:6daaaf1a1e07

File content as of revision 32:7c921089af60:

#include "mbed.h"


Serial rs232(PA_2, PA_3);  //9600 baud rate
Serial mypc(USBTX, USBRX); //9600 baud rate

DigitalOut led1(PA_0); //  MTUDK2-ST-MDOT Developer Kit D3
DigitalOut led2(PA_1); //  MTUDK2-ST-MDOT Developer Kit D6
DigitalOut led3(PA_11); //  MTUDK2-ST-MDOT Developer Kit D7


// main() runs in its own thread in the OS
int main() {
    
    led2 = 0; // The MTUDK2-ST-MDOT has a 74LCX14MTC before the LEDs, which inverts therefore 0 = on
    led3 = 0;
    
            
    while (true) {
        led1 = !led1;
        wait(2); //2s
        
        rs232.printf("Serial:LED is now %d\r\n", led1.read());
        mypc.printf("USB:I'm  working\r\n");
        
        rs232.putc(rs232.getc()); //wait for char from rs232 and echo it back
   }
}