Robert Labuz
/
mbed2_1_c
mbed2_1_c
main.cpp
- Committer:
- Robsonik16
- Date:
- 2017-05-05
- Revision:
- 0:2837dff52865
File content as of revision 0:2837dff52865:
#include "mbed.h" //------------------------------------ // Hyperterminal configuration // 9600 bauds, 8-bit data, no parity //------------------------------------ RawSerial pc(USBTX,USBRX,9600); DigitalOut led_green(LED1); DigitalOut led_red(LED2); InterruptIn user_button(USER_BUTTON); float delay_on = 0.2; float delay_off = 1.0; void button_pressed() { delay_on = 0.1; delay_off = 0.1; } void button_released() { delay_on = 0.2; delay_off = 1.0; } int main() { user_button.rise(&button_pressed); user_button.fall(&button_released); //pc.format(8, Serial::None, 1); //pc.baud(9600); bool c=false; while(1) { //pc.printf("This program runs since %d seconds.\r\n", i); //wait(1); if (pc.readable()){ pc.getc (); c=!c; led_green = c; } /* for(char a = 'a';a<='z';a++){ pc.putc(a); pc.putc('\r'); pc.putc('\n'); wait(0.1); } */ } }