mDot / Mbed 2 deprecated PA0_Test

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Test.cpp Source File

Test.cpp

00001 #include "mbed.h"
00002 #include "MTSLog.h"
00003 
00004 DigitalInOut myPort(PA_0);
00005 //DigitalOut myPort(PA_0);
00006 //DigitalIn myPort(PA_0);
00007 Serial debug(USBTX, USBRX);
00008 
00009 main()
00010 {
00011     int i;
00012     bool mode = true;
00013     debug.baud(115200);
00014     myPort.mode(PullDown);
00015     mts::MTSLog::setLogLevel(mts::MTSLog::INFO_LEVEL);
00016     logInfo("Starting PA0 Tester");
00017     for(i=0; i<200; i++)
00018     {
00019         logInfo("Running Loop %d", i);   
00020         myPort.output();
00021         int myData = mode ? 0 : 1;
00022         myPort.write(myData);
00023         logInfo("Set PA0: %d", myData);
00024         mode = !mode;
00025         wait(5);
00026         myPort.input();
00027         int value = myPort.read();
00028         logInfo("PA0 value: %d", value);
00029         wait(5);
00030     }
00031 }
00032