
Triangle WAVE Generator for RealTimeTarget Matlab demonstration
Revision 0:d82e60b5b3ee, committed 2017-04-19
- Comitter:
- STM32Workshop
- Date:
- Wed Apr 19 13:19:05 2017 +0000
- Child:
- 1:73b4e3ea09b7
- Commit message:
- Triangle WAVE Generator for RealTimeTarget Matlab demonstration
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 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Apr 19 13:19:05 2017 +0000 @@ -0,0 +1,29 @@ +#include "mbed.h" + +//------------------------------------ +// Hyperterminal configuration +// 57600 bauds, 8-bit data, no parity +//------------------------------------ + +Serial pc(SERIAL_TX, SERIAL_RX); + +Timer TimeCount; + +DigitalOut myled(LED1); + +uint32_t Counter=0; + +int main() +{ + pc.baud(57600); + TimeCount.start(); + while(1) { + wait_ms(20); // more or less 20 millis delay loop + Counter++; + Counter=Counter%50; // around 1hz frequency + if (Counter==0) { + myled = !myled; + } + pc.printf("REC:%d,%d\r\n",TimeCount.read_us(),Counter); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Apr 19 13:19:05 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/6c34061e7c34 \ No newline at end of file