USB Serial application

Fork of USBSerial_HelloWorld by Samuel Mokrani

main.cpp

Committer:
Zaitsev
Date:
2017-12-16
Revision:
11:b3f2a8bdac4d
Parent:
10:41552d038a69

File content as of revision 11:b3f2a8bdac4d:

#include "mbed.h"
#include "USBSerial.h"

DigitalOut  myled(LED1);

int main() {
    //confSysClock();     //Configure system clock (72MHz HSE clock, 48MHz USB clock)
    //SYSTEM CLOCK changed in stm32f4xx_hal.c
    USBSerial usbSerial;
    Serial serial(PTE20, PTE21);
    
    
    while(1) {
        if(serial.readable())
        {
            //usbSerial.putc(serial.getc());
        }
        myled = !myled;
        if(usbSerial.readable()) //if there is any character to read from usbSerial
        {
        usbSerial.putc('c');
          usbSerial.putc('h');
          usbSerial.putc('u');
          usbSerial.putc('j');
           usbSerial.getc();           
        }
    }
}