Assembly procedure that represents binary using the LEDs on the mbed.

Dependencies:   mbed

main.cpp

Committer:
jp
Date:
2011-01-28
Revision:
2:a81c9bc37084
Parent:
1:7490aeb7d770

File content as of revision 2:a81c9bc37084:

//
//   INTEGER TO BINARY by J.P. Armstrong
//   http://www.armtronics.com/
//  
//   Improved by Igor Skochinsky
//
//   PART OF CODE FROM:
//   http://mbed.org/cookbook/Assembly-Language

#include "mbed.h"

// This program will blink LED1 and LED4
// using assembly language for LED1 and
// API functions for LED4
// declare external assembly language function (in a *.s file)
extern "C" int binasm(int value);
// declare LED outputs � let C set them up as output bits

DigitalOut myled1(LED1);
DigitalOut myled2(LED2);
DigitalOut myled3(LED3);
DigitalOut myled4(LED4);

int main() {
       
     int i = 1; 
     
     while (true) {
         binasm(i % 16);
         wait(0.1);
         i++;
     }
     
}