Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 3:8ca8be33da99, committed 2013-04-09
- 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 |
diff -r 2380496d04fd -r 8ca8be33da99 main.cpp
--- 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