First draft HMC5883 magnetometer sensor using physical quantities, outputting via serial port using std::cout on mbed os 5
Diff: loop_forever.cpp
- Revision:
- 10:75c8ce89aeb7
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/loop_forever.cpp Thu Mar 26 21:59:18 2020 +0000 @@ -0,0 +1,18 @@ + +#include "mbed.h" +#include <iostream> + +// terminal loop, printing message periodically +void loop_forever(std::string const & str) +{ + DigitalOut led1(LED1,1); + // stop but print error dynamically + int count = 0; + for (;;) { + led1 = 1; + std::cout << str << " " << count++ << '\n'; + ThisThread::sleep_for(200U); + led1 = 0; + ThisThread::sleep_for(800U); + } +} \ No newline at end of file