VR FabLab - RoboVal
/
DiagnosticoTastierino
Gestione tastierino robotval
Revision 0:051324d87f93, committed 2018-05-05
- Comitter:
- fdalforno
- Date:
- Sat May 05 14:42:39 2018 +0000
- Commit message:
- diagnostico per tastierino robotval
Changed in this revision
diff -r 000000000000 -r 051324d87f93 TextLCD.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Sat May 05 14:42:39 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/simon/code/TextLCD/#308d188a2d3a
diff -r 000000000000 -r 051324d87f93 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat May 05 14:42:39 2018 +0000 @@ -0,0 +1,71 @@ +#include "mbed.h" +#include "TextLCD.h" + +DigitalOut myled(LED1); + + +PinName rowPins[4] = { PB_0 , PA_4 , PA_1 , PA_0 }; +PinName colPins[4] = { PA_13 , PA_14 , PC_14 , PC_15 }; + +DigitalOut* _rows[4]; +DigitalIn* _cols[4]; + +TextLCD lcd(D2,D3,D4,D5,D6,D7); + +void printKeyBoard(){ + //lcd.cls(); + + + lcd.locate(0,0); + lcd.printf("KeyBoard: "); + + lcd.locate(0,1); + for(int i = 0;i < 4 ;i++){ + DigitalOut *row = _rows[i]; + + char level = 'L'; + if(row->read() == 1){ + level = 'H'; + } + lcd.printf( "%c" , level); + } + + lcd.printf( "%c" , " "); + + + for(int i = 0;i < 4;i++){ + DigitalIn *col = _cols[i]; + + char level = 'L'; + if(col->read() == 1){ + level = 'H'; + } + lcd.printf( "%c" , level); + } + +} + +int main() { + + lcd.locate(0,0); + lcd.printf("Clean"); + + + for(int i = 0;i < 4; i++){ + _rows[i] = new DigitalOut(rowPins[i]); + _rows[i]->write(0); + } + for(int i = 0;i < 4; i++){ + _cols[i] = new DigitalIn(colPins[i],PullDown); + } + + + while(1) { + for (int i = 0; i < 4; i++) { + _rows[i]->write(1); + printKeyBoard(); + wait(0.5); + _rows[i]->write(0); + } + } +}
diff -r 000000000000 -r 051324d87f93 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat May 05 14:42:39 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/5aab5a7997ee \ No newline at end of file