When debugging code it can be handy to examine/alter variables and to check the state of input lines. So your main program can run and you have access to alter variables and run functions from a terminal. In this sample the main program is just a loop that flashes an LED. In that loop a periodic call is made to ShellTC which handles any commands from the serial terminal. The code is a bit quirky(it was originally written for a very resource limited device) but it works well enough to be useful, hence its published. More details in the main.cpp
.
Diff: main.cpp
- Revision:
- 4:107d2d3294da
- Parent:
- 3:6a35fb789679
--- a/main.cpp Wed Feb 04 21:07:52 2015 +0000 +++ b/main.cpp Fri Feb 06 09:46:44 2015 +0000 @@ -15,6 +15,8 @@ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + + #include "mbed.h" #include "shell.h" #include "mon.h"