aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2010-06-11 13:17:07 -0400
committerbnewbold <bnewbold@robocracy.org>2010-06-11 13:17:07 -0400
commite9fc9d4e2ae46caf9184a358b02ee79394d7e095 (patch)
treef446bac3d55e4b1864abef24afd1ba39f86beb80
parentcb1a6fbc210a3c6a68b1b1cecf39e0cb9cffa1aa (diff)
downloadlibrambutan-e9fc9d4e2ae46caf9184a358b02ee79394d7e095.tar.gz
librambutan-e9fc9d4e2ae46caf9184a358b02ee79394d7e095.zip
helpful debug program
-rw-r--r--examples/debug-dtrrts.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/examples/debug-dtrrts.cpp b/examples/debug-dtrrts.cpp
new file mode 100644
index 0000000..c85b342
--- /dev/null
+++ b/examples/debug-dtrrts.cpp
@@ -0,0 +1,42 @@
+// Sample main.cpp file. Blinks an LED, sends a message out USART2
+// and turns on PWM on pin 2
+
+#include "wirish.h"
+#include "usb.h"
+
+#define LED_PIN 13
+#define PWM_PIN 2
+
+void setup()
+{
+ /* Set up the LED to blink */
+ pinMode(LED_PIN, OUTPUT);
+
+ /* Send a message out USART2 */
+ Serial2.begin(9600);
+ Serial2.println("Debugging DTR/RTS...");
+
+}
+
+int toggle = 0;
+
+void loop() {
+ toggle ^= 1;
+ digitalWrite(LED_PIN, toggle);
+ delay(100);
+ Serial2.print("DTR: ");
+ Serial2.print(usbGetDTR(), DEC);
+ Serial2.print("\tRTS: ");
+ Serial2.println(usbGetRTS(), DEC);
+}
+
+
+int main(void) {
+ init();
+ setup();
+
+ while (1) {
+ loop();
+ }
+ return 0;
+}