Embedded system Fun Blog
























































Find out all the best information, libraries and circuit about the latest Embedded systems.

Saturday 7 January 2012

MBED Example: Flash an LED while a DigitalIn is true

.from: http://mbed.org/projects/libraries/svn/mbed/trunk/DigitalIn.h

/* mbed Microcontroller Library - DigitalIn
 * Copyright (c) 2006-2011 ARM Limited. All rights reserved.
 */ 

// Flash an LED while a DigitalIn is true
#include "mbed.h"
DigitalIn enable(p5);
DigitalOut led(LED1);
int main() {
  while(1) {
  if(enable) {
   led = !led;
  }
   wait(0.25);
  }
}

No comments:

Post a Comment