Testing timer issues

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
vaxon
Date:
Tue Apr 09 01:20:54 2013 +0000
Parent:
2:2380496d04fd
Commit message:
Cleaner example. ; At 100ns, the green LED blinks on .25sec, off .75sec and serial prints "j"; At 20 it is locked up.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Mon Apr 08 19:22:40 2013 +0000
+++ b/main.cpp	Tue Apr 09 01:20:54 2013 +0000
@@ -1,49 +1,34 @@
 #include "mbed.h"
-DigitalOut led(LED3);
+DigitalOut led(PTB19); //green
 Serial pc(USBTX, USBRX); // tx, rx
 
 Ticker period;
-//PwmOut psignal(PTD4);
-//AnalogOut signal(PTE30);
 
-//Timer t1;
 uint16_t j=0;
 
 void tick()
 {
 
-    if (j<5) {
+    if (j<2500) {
         led=0;
     } else {
         led=1;
     }
 
-    j+=1;
+    j++;
     j%=10000;
 
-
-//signal.write_u16(j);
-//psignal=j;
-
 }
 
 int main()
 {
-//period.attach_us(tick,100); works
-    period.attach_us(tick,20); //nope
+  //  period.attach_us(tick,100); // serial and blink work
+   period.attach_us(tick,20); //nope
 
 
-//    t1.start();
-
-    /*
-        while (1) {
-            pc.printf("j: %d\n\r",j );
-            //  a1=t1.read_us ()
+    while (1) {
+        pc.printf("j: %d\n\r",j );
+      
+    }
 
-            if (t1.read_ms ()==10) {
-                DDS();
-                t1.reset ();
-            }
-       }
-       */
 }
\ No newline at end of file