Robert Labuz
/
mbed2_1_a
mbed2_1_a
Revision 0:5830485b65dc, committed 2017-05-05
- Comitter:
- Robsonik16
- Date:
- Fri May 05 19:43:12 2017 +0000
- Commit message:
- a
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 5830485b65dc main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri May 05 19:43:12 2017 +0000 @@ -0,0 +1,65 @@ +#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); + + int i=0; + + while(1) { + + //pc.printf("This program runs since %d seconds.\r\n", i); + + i++; + + wait(1); + /* + // LEDs are ON + led_green = 1; + led_red = 1; + wait(delay_on); + // LEDs are OFF + led_green = 0; + led_red = 0; + wait(delay_off); + */ + for(char a = 'a';a<='z';a++){ + pc.putc(a); + pc.putc('\r'); + pc.putc('\n'); + wait(0.1); + } + } +}
diff -r 000000000000 -r 5830485b65dc mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri May 05 19:43:12 2017 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/mbed_official/code/mbed/builds/97feb9bacc10 \ No newline at end of file