Ilya Kazarin / Mbed 2 deprecated F401RE_8bit_Arduino11

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 InterruptIn ePin(PC_0);
00004 Serial pc(USBTX, USBRX);
00005 //DigitalIn a(PC_3);
00006 //DigitalIn b(PC_2);
00007 //DigitalIn c(PC_6);
00008 //DigitalIn d(PC_8);
00009 //DigitalIn e(PC_9);
00010 //DigitalIn f(PC_10);
00011 //DigitalIn g(PC_11);
00012 //DigitalIn h(PC_12);
00013 
00014 
00015 uint16_t inputBytes;
00016 uint8_t thereIsInputFlag = 0;
00017 
00018 PortIn  Portc(PortC, (1<<3)|(1<<2)|(1<<6)|(1<<8)|(1<<9)|(1<<10)|(1<<11)|(1<<12)); //(1<<10)|(1<<11)|...
00019 //PortIn  Porta(PortA, (1<<13)|(1<<14)|(1<<15)); 
00020 
00021 void inputHandler(){
00022 
00023      inputBytes = Portc.read();
00024      thereIsInputFlag = 1;
00025 }
00026 
00027 int main()
00028 {
00029     ePin.mode(PullUp);
00030     //a.mode(PullDown);
00031     //b.mode(PullDown);
00032     //c.mode(PullDown);
00033     //d.mode(PullDown);
00034     //e.mode(PullDown);
00035     //f.mode(PullDown);
00036     //g.mode(PullDown);
00037     //h.mode(PullDown);          
00038     pc.baud(19200);
00039     ePin.fall(&inputHandler);
00040     while(1){
00041         if(thereIsInputFlag) {
00042                 pc.printf("%X", inputBytes);
00043                 thereIsInputFlag = 0;
00044         }
00045     }
00046 }