Chris Hatfield / Mbed 2 deprecated WatchAndTrace

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 
00002 #include "Config.h"
00003 #include "mbed.h"
00004 #include "RemoteFunc.h"
00005 
00006 //Set Up Debug Environment
00007 IMPLEMENT_DBUG;
00008 
00009 Ticker tkInterrupt;
00010 
00011 DigitalOut Led1(LED1);
00012 DigitalOut Led2(LED2);
00013 DigitalOut Led3(LED3);
00014 DigitalOut Led4(LED4);
00015 
00016 const float fWait(1.0);
00017 
00018 long nIntegrand(0);
00019 
00020 int main()
00021 {
00022   DBUG_INIT(8);
00023 
00024   while(true)
00025   {
00026     TRACE("Beginning of Loop\n\r");
00027     WATCH("Integrand     %6ld", nIntegrand++);
00028 
00029     if (nIntegrand % 3)
00030       RemoteFunction(nIntegrand);
00031       
00032     // Display Diagnostics LEDs
00033     Led1 = (nIntegrand % 2 == 0);
00034     Led2 = (nIntegrand % 3 == 0);
00035     Led3 = (nIntegrand % 4 == 0);
00036     Led4 = (nIntegrand % 5 == 0);
00037     WATCH("%s", Led1 ? "^RLED 1^r" : "LED 1");
00038     WATCH("%s", Led2 ? "^RLED 2^r" : "LED 2");
00039     WATCH("%s", Led3 ? "^RLED 3^r" : "LED 3");
00040     WATCH("%s", Led4 ? "^RLED 4^r" : "LED 4");
00041     TRACE("Waiting for %2.1f Seconds\n\r", fWait);
00042     wait(fWait);
00043     TRACE("End Of Loop\n\r");
00044   }
00045 }