
Hertz Controle
main.cpp
- Committer:
- ABuche
- Date:
- 2018-04-15
- Revision:
- 0:f101b014b4a1
File content as of revision 0:f101b014b4a1:
#include "mbed.h" /*------------------------------------------------------------------------------ Before to use this example, ensure that you an hyperterminal installed on your computer. More info here: https://developer.mbed.org/handbook/Terminals The default serial comm port uses the SERIAL_TX and SERIAL_RX pins (see their definition in the PinNames.h file). The default serial configuration in this case is 9600 bauds, 8-bit data, no parity If you want to change the baudrate for example, you have to redeclare the serial object in your code: Serial pc(SERIAL_TX, SERIAL_RX); Then, you can modify the baudrate and print like this: pc.baud(115200); pc.printf("Hello World !\n"); ------------------------------------------------------------------------------*/ //Serial pc(PA_9, PA_10); Serial regis(PA_10, PA_11); DigitalOut led(LED1); DigitalOut led2(LED2); int main() { const int bufferSize = 1024; int * buffer = new int [bufferSize]; int i = 1; char c = 'w'; //pc.printf("Hello World !\n"); led = 0; led2= 0; while(1) { //pc.printf("This program runs since %d seconds.\r\n", i++); c = regis.getc(); if (c == 'w'){ led = 1; } else{ led2 = 1; } //pc.printf("Char: %c", c); //if(regis.readable()){ // pc.printf("Woooooow\r\n"); //} i++; if(i % 10 == 0){ led2 = !led2; } } }