Raynaud Gilles
/
Codeur2
Codeur2
Revision 0:0f28724debac, committed 2020-11-07
- Comitter:
- gr66
- Date:
- Sat Nov 07 17:38:10 2020 +0000
- Commit message:
- Codeur2
Changed in this revision
diff -r 000000000000 -r 0f28724debac C12832.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C12832.lib Sat Nov 07 17:38:10 2020 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/chris/code/C12832/#7de323fa46fe
diff -r 000000000000 -r 0f28724debac main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Nov 07 17:38:10 2020 +0000 @@ -0,0 +1,79 @@ +/**********************************************************************/ +/* */ +/* Programme de test de l'extension codeur */ +/* pour la carte F446RE */ +/* */ +/* Sylvain CASTANET - Octobre 2019 */ +/* */ +/* ------ */ +/* */ +/* Test des différentes fonctions de la carte : */ +/* - codeur incrémental */ +/* - poussoir du codeur */ +/* - Led */ +/* */ +/**********************************************************************/ + +#include "mbed.h" +#include "C12832.h" + +// Using Arduino pin notation +C12832 lcd(D11, D13, D12, D7, D10); + +// Entrées numériques +//InterruptIn CodeurA(PA_15,PullUp); // Mode PullUp +//DigitalIn CodeurB(PA_14,PullUp); // Mode PullUp +InterruptIn BP(PC_12); // Mode PullUp +InterruptIn CodeurA(PA_15); //PB_7 +InterruptIn CodeurB(PB_7); //PA_15 +//InterruptIn BP(PC_12); +Serial pc(SERIAL_TX, SERIAL_RX); + + +// Leds +DigitalOut Led(PC_10); + +int counter=0; + + +// Sortie de test + + +void ca(){ + if(CodeurB==0)counter++; + } +void cb(){ + if(CodeurA==0)counter--; + } + +void clignot(){ + Led = !Led; + counter=0; +} + +int main() +{ + lcd.cls(); // Clear screen + lcd.locate(0,3); // 1ere ligne + lcd.printf("Essai du module codeur"); +BP.mode(PullUp); +CodeurA.mode(PullUp); +CodeurB.mode(PullUp); +pc.printf("Hello world \n"); + Led = 1; + CodeurA.fall(&ca); + CodeurB.fall(&cb); + BP.fall(&clignot); + + while(1) { + + pc.printf("Compteur : %d \r\n",counter); + lcd.locate(0,15); + lcd.printf("Compteur : %d ",counter); + wait_ms(100); + + + + wait(0.1); + } +}
diff -r 000000000000 -r 0f28724debac mbed-os.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-os.lib Sat Nov 07 17:38:10 2020 +0000 @@ -0,0 +1,1 @@ +https://github.com/ARMmbed/mbed-os/#c9e63f14085f5751ff5ead79a7c0382d50a813a2