Just sending seconds counter to the serial port

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002  
00003 Serial              pc(USBTX, USBRX);
00004 Ticker              timeKeeping;
00005 
00006 volatile uint64_t   seconds = 0;
00007 
00008 void secondsCallback(void) {
00009     pc.printf("Number of seconds: %x\r\n", seconds);
00010     seconds ++;
00011 }
00012  
00013 int main() {
00014     timeKeeping.attach(&secondsCallback, 1.0f);
00015     while(1) {}
00016 }