J.P. Armstrong / Mbed 2 deprecated IntToBinaryAssembly

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 //
00002 //   INTEGER TO BINARY by J.P. Armstrong
00003 //   http://www.armtronics.com/
00004 //  
00005 //   Improved by Igor Skochinsky
00006 //
00007 //   PART OF CODE FROM:
00008 //   http://mbed.org/cookbook/Assembly-Language
00009 
00010 #include "mbed.h"
00011 
00012 // This program will blink LED1 and LED4
00013 // using assembly language for LED1 and
00014 // API functions for LED4
00015 // declare external assembly language function (in a *.s file)
00016 extern "C" int binasm(int value);
00017 // declare LED outputs � let C set them up as output bits
00018 
00019 DigitalOut myled1(LED1);
00020 DigitalOut myled2(LED2);
00021 DigitalOut myled3(LED3);
00022 DigitalOut myled4(LED4);
00023 
00024 int main() {
00025        
00026      int i = 1; 
00027      
00028      while (true) {
00029          binasm(i % 16);
00030          wait(0.1);
00031          i++;
00032      }
00033      
00034 }