Philip Freidin / Mbed 2 deprecated OSHChip_Blinky

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers OSHChip_Blinky.cpp Source File

OSHChip_Blinky.cpp

00001 //
00002 //  OSHChip_Blinky.cpp
00003 //
00004 //  Default mbed nRF51822 platforms all have BLE added
00005 //
00006 //  Default UART output on OSHChip pin 1 should be connected to OSHChip_CMSIS_DAP connector J5
00007 //  which is the 2 pin connector in the corner of the board. Connect to the pin closest to the
00008 //  corner of the board.  If you are going to use serial input, connect the other pin of J5 to
00009 //  pin 2 of OSHChip. If you are not going to use the UART, OSHChip pins 1 and 2 can be re-assigned
00010 //
00011 
00012 #include "mbed.h"
00013 #include "OSHChip_Pin_Names.h"
00014 
00015 DigitalOut red_led(PinName LED_RED);
00016 DigitalOut green_led(PinName LED_GREEN);
00017 DigitalOut blue_led(PinName LED_BLUE);
00018 
00019 #define DELAY       (100)
00020 #define LED_ON      (0)
00021 #define LED_OFF     (1)
00022 
00023 int main(void)
00024 {
00025     uint32_t    loop_count;
00026     
00027     OSHChip_Init();
00028 
00029     loop_count = 0;
00030 
00031     while(1) {
00032         red_led   = LED_ON;
00033 
00034         wait_ms(DELAY);
00035 
00036         red_led   = LED_OFF;
00037 
00038         wait_ms(DELAY);
00039 
00040         red_led   = LED_ON;
00041         green_led = LED_ON;
00042 
00043         wait_ms(DELAY);
00044 
00045         red_led   = LED_OFF;
00046         green_led = LED_OFF;
00047         blue_led  = LED_ON;
00048 
00049         wait_ms(DELAY);
00050 
00051         blue_led  = LED_OFF;
00052 
00053         printf("Loop Count:  %8d\r\n", loop_count++);
00054     }
00055 }