Geoffrey Lansberry / Mbed 2 deprecated ExampleLibrary_Program

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers example.cpp Source File

example.cpp

00001 #include "mbed.h"
00002 
00003 class LED_TEST:public DigitalOut{
00004    public:
00005    LED_TEST(PinName pin):DigitalOut(pin) {};
00006 
00007    void TurnOn() {write(1);}
00008    void TurnOff() {write(0);}
00009 };
00010 
00011 #ifdef __IN_A_PROGRAM   //if I'm compiling as a program then I want to create this main for testing.
00012                         //if I'm compiling as a library I do not want the main to prevent linker problems
00013 int main(void)
00014 {
00015 LED_TEST lt(LED1);
00016     while (1)
00017     {
00018         lt.TurnOn();
00019         wait(1);
00020         lt.TurnOff();
00021         wait(1);
00022     }
00023 }
00024 #endif