SMPTE timedode (LTC) decode library for mbed https://developer.mbed.org/users/okini3939/code/LTC_SMPTE/

Dependencies:   LTC_SMPTE mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "LTC_SMPTE.h"
00003 
00004 DigitalOut led1(LED1), led2(LED2);
00005 Serial pc(USBTX, USBRX);
00006 
00007 LTC_SMPTE ltc(p21, LTC_SMPTE::LTC_INPUT); // input
00008 //LTC_SMPTE ltc(p22, LTC_SMPTE::LTC_OUTPUT); // output
00009 
00010 int main() {
00011     pc.baud(115200);
00012     pc.printf("*** LTC\r\n");
00013     led1 = 1;
00014     led2 = 0;
00015 
00016     // input
00017     while(1) {
00018         if (ltc.isReceived()) {
00019             int hour, min, sec, frame;
00020             ltc.read(&hour, &min, &sec, &frame);
00021             pc.printf("%d %d %d %d\r\n", hour, min, sec, frame);
00022             led2 = !led2;
00023         }
00024     }
00025 /*
00026     // output
00027     ltc.write(0, 0, 0, 0);
00028     while (1) {
00029         int hour, min, sec, frame;
00030         ltc.read(&hour, &min, &sec, &frame);
00031         pc.printf("%d %d %d %d\r\n", hour, min, sec, frame);
00032         led2 = !led2;
00033         wait(1);
00034     }
00035 */
00036 }