ejemplo de leer encoder con bluepill stm32f411
Dependencies: mbed QEI Debounced TextLCD
EJEMPLO USANDO LA PLACA STM32F411CEU6
La intencion es leer un encoder rotatorio de arduino prestar atencion a las fases algo de inestabilidad por ruido, posibles ajustes pulsos por revolucion e insertar condensadores de filtro en las fases
Revision 0:401dcb5672a4, committed 2022-07-21
- Comitter:
- tony63
- Date:
- Thu Jul 21 00:46:15 2022 +0000
- Commit message:
- Ejemplo con la placa bluepill STM32F411
Changed in this revision
diff -r 000000000000 -r 401dcb5672a4 Debounced.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Debounced.lib Thu Jul 21 00:46:15 2022 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/WarwickRacing/code/Debounced/#8992c13bbb9b
diff -r 000000000000 -r 401dcb5672a4 QEI.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QEI.lib Thu Jul 21 00:46:15 2022 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/aberk/code/QEI/#5c2ad81551aa
diff -r 000000000000 -r 401dcb5672a4 TextLCD.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Thu Jul 21 00:46:15 2022 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/simon/code/TextLCD/#308d188a2d3a
diff -r 000000000000 -r 401dcb5672a4 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Jul 21 00:46:15 2022 +0000 @@ -0,0 +1,38 @@ +#include "mbed.h" +#include "DebouncedIn.h" +#include "TextLCD.h" +#include "QEI.h" + + +TextLCD lcd(PA_8,PA_9,PB_12,PB_13,PB_14,PB_15); // rs, e, d4-d7 +QEI wheel (PB_0,PB_1, NC, 100); + + +//DebouncedIn button1(PTC12); +//ebouncedIn button2(PTC13); + + +int C1=0x0E; // solo muestra el curzor +int C2=0x18; // desplaza izquierda +int C3=0x1A; // desplaza derecha +int C4=0x0C; // quito cursor bajo + + +int i; // indice de la variable +DigitalIn CHA(PB_0, PullUp); +DigitalIn CHB(PB_1, PullUp); + +int main() { + lcd.cls(); + + lcd.locate(0,0); + lcd.printf("CONTEO="); + while(1) + { + lcd.locate(7,0); + lcd.printf("%d",wheel.getPulses()); + lcd.locate(7,0); + wait(0.5); + lcd.printf(" "); + } + }
diff -r 000000000000 -r 401dcb5672a4 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Jul 21 00:46:15 2022 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file