Ilya Kazarin
/
F401RE_8bit_Arduino11
123
main.cpp
- Committer:
- lucem1n
- Date:
- 2019-07-03
- Revision:
- 0:03476464e975
File content as of revision 0:03476464e975:
#include "mbed.h" InterruptIn ePin(PC_0); Serial pc(USBTX, USBRX); //DigitalIn a(PC_3); //DigitalIn b(PC_2); //DigitalIn c(PC_6); //DigitalIn d(PC_8); //DigitalIn e(PC_9); //DigitalIn f(PC_10); //DigitalIn g(PC_11); //DigitalIn h(PC_12); uint16_t inputBytes; uint8_t thereIsInputFlag = 0; PortIn Portc(PortC, (1<<3)|(1<<2)|(1<<6)|(1<<8)|(1<<9)|(1<<10)|(1<<11)|(1<<12)); //(1<<10)|(1<<11)|... //PortIn Porta(PortA, (1<<13)|(1<<14)|(1<<15)); void inputHandler(){ inputBytes = Portc.read(); thereIsInputFlag = 1; } int main() { ePin.mode(PullUp); //a.mode(PullDown); //b.mode(PullDown); //c.mode(PullDown); //d.mode(PullDown); //e.mode(PullDown); //f.mode(PullDown); //g.mode(PullDown); //h.mode(PullDown); pc.baud(19200); ePin.fall(&inputHandler); while(1){ if(thereIsInputFlag) { pc.printf("%X", inputBytes); thereIsInputFlag = 0; } } }