Difference between revisions of "Example: Blinking led"

From Miosix Wiki
Jump to: navigation, search
(Created page with "== Simple Example == <source lang="cpp"> #include <cstdio> #include <unistd.h> #include "miosix.h" using namespace std; using namespace miosix; typedef Gpio<GPIOC_BASE,7> l...")
 
m
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
== Simple Example ==
+
=== Simple blink ===
 +
This example file can be found in ''miosix/_examples/blinking_led/simple.cpp''
 
<source lang="cpp">
 
<source lang="cpp">
 
#include <cstdio>
 
#include <cstdio>

Latest revision as of 13:05, 25 April 2014

Simple blink

This example file can be found in miosix/_examples/blinking_led/simple.cpp

#include <cstdio>
#include <unistd.h>
#include "miosix.h"

using namespace std;
using namespace miosix;

typedef Gpio<GPIOC_BASE,7>  led;

int main()
{
  
  led::mode(Mode::OUTPUT);
  
  for(;;) {
    led::high();
    sleep(1);
    led::low();
    sleep(1);
  }
  
  return 0;
  
}