Skip to content

Instantly share code, notes, and snippets.

@ah01
Created December 29, 2014 00:01
Show Gist options
  • Save ah01/1ddb5b17df0507759145 to your computer and use it in GitHub Desktop.
Save ah01/1ddb5b17df0507759145 to your computer and use it in GitHub Desktop.
Visual Micro - debug code
#include "arduino.h"
#include <VM_DBG.h>
unsigned long time;
bool output;
void setup()
{
// MicroDebug setup
delay(2000);
MicroDebug.begin(&Serial,115200);
MicroDebug.outPacketStart();
MicroDebug.transport->print("VMDPV_1|1_VMDPV");
MicroDebug.transport->println();
delay(10);
MicroDebug.start(false,true);
pinMode(13, OUTPUT);
}
void loop()
{
if (millis() - time > 1000)
{
time = millis();
// trace value of time
MicroDebug.outPacketStart();
MicroDebug.transport->print("VMDPE_2");
MicroDebug.transport->print("|");
MicroDebug.transport->print(time);
MicroDebug.transport->println("_VMDPE");
delay(5);
// breakpoint - wait for contrinue
delay(10);
MicroDebug.breakWait(2);
output = ! output;
// trace value of output
MicroDebug.outPacketStart();
MicroDebug.transport->print("VMDPE_1");
MicroDebug.transport->print("|");
MicroDebug.transport->print(output);
MicroDebug.transport->println("_VMDPE");
delay(5);
digitalWrite(13, output);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment