ll
Dependencies: mbed TextLCD MMA8451Q
Revision 1:a53d08aeb6ff, committed 2020-12-04
- Comitter:
- poresc
- Date:
- Fri Dec 04 02:49:25 2020 +0000
- Parent:
- 0:f9c8e84340f6
- Commit message:
- ll
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MMA8451Q.lib Fri Dec 04 02:49:25 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/MSS/code/MMA8451Q/#5a09d01c6a2c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Fri Dec 04 02:49:25 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/simon/code/TextLCD/#308d188a2d3a
--- a/main.cpp Thu Nov 26 04:14:30 2020 +0000
+++ b/main.cpp Fri Dec 04 02:49:25 2020 +0000
@@ -1,26 +1,67 @@
#include "mbed.h"
+#include "TextLCD.h"
Ticker rampa;
-BusOut step_secuence(PTA12,PTD4,PTA2,PTA2);//step_secuence=1010
-DigitalOut myled(LED1);
-int contador =0,second;
-float retardo,operacionrampa;
-void rampa1(){
+TextLCD lcd(PTE20,PTE21,PTE22,PTE23,PTE29,PTE30, TextLCD::LCD16x2);
+
- contador=contador+1;
- if (contador>=10){
- contador=10;
+BusOut step_secuence(PTB0,PTB1,PTB2,PTB3);//step_secuence=1010
+DigitalOut myled(LED1);
+int contador =20,k=0,second;
+float retardo,operacionrampa,m;
+void rampa1(){
+ lcd.cls();
+ lcd.locate(0,1);
+ lcd.printf("millos");
+
+ contador=contador-1;
+ if (contador<=1){
+ contador=1;
}
- }
+ }
int main() {
- rampa.attach(&rampa1,second*0.1);
+ rampa.attach(&rampa1,20*0.1);
//ejemplo ,
// second
//rpm
//operacionrampa=60/rpm*numeropasos*10
+ operacionrampa=0.0030;
+ lcd.cls();
+ lcd.locate(0,1);
+ lcd.printf("%.3f",operacionrampa);
- wait(operacionrampa*contador);
+ // step_secuence=0b11;
+ if(operacionrampa!=0){
+ k=0;
+ for (int i =0; i<=900; i++) {
+ if (k>=4) {
+ k=0;
+ }
+ switch (k) {
+ case 0:
+ step_secuence=0b01;
+ break;
+ case 1:
+ step_secuence=0b10;
+ break;
+ case 2:
+ step_secuence=0b100;
+ break;
+ case 3:
+ step_secuence=0b1000;
+ break;
+ }
+ k=k+1;
+ m=operacionrampa*contador;
+ lcd.cls();
+ lcd.locate(0,0);
+ lcd.printf("%.3f",m);
+ wait(m);
+ // wait(1);
+ }
+
+ }
}