Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed TextLCD MMA8451Q
main.cpp
00001 #include "mbed.h" 00002 #include "TextLCD.h" 00003 00004 Ticker rampa; 00005 00006 TextLCD lcd(PTE20,PTE21,PTE22,PTE23,PTE29,PTE30, TextLCD::LCD16x2); 00007 00008 00009 BusOut step_secuence(PTB0,PTB1,PTB2,PTB3);//step_secuence=1010 00010 DigitalOut myled(LED1); 00011 int contador =20,k=0,second; 00012 float retardo,operacionrampa,m; 00013 void rampa1(){ 00014 lcd.cls(); 00015 lcd.locate(0,1); 00016 lcd.printf("millos"); 00017 00018 contador=contador-1; 00019 if (contador<=1){ 00020 contador=1; 00021 } 00022 } 00023 int main() { 00024 rampa.attach(&rampa1,20*0.1); 00025 //ejemplo , 00026 // second 00027 //rpm 00028 //operacionrampa=60/rpm*numeropasos*10 00029 operacionrampa=0.0030; 00030 lcd.cls(); 00031 lcd.locate(0,1); 00032 lcd.printf("%.3f",operacionrampa); 00033 00034 // step_secuence=0b11; 00035 if(operacionrampa!=0){ 00036 k=0; 00037 for (int i =0; i<=900; i++) { 00038 if (k>=4) { 00039 k=0; 00040 } 00041 switch (k) { 00042 case 0: 00043 step_secuence=0b01; 00044 break; 00045 case 1: 00046 step_secuence=0b10; 00047 break; 00048 case 2: 00049 step_secuence=0b100; 00050 break; 00051 case 3: 00052 step_secuence=0b1000; 00053 break; 00054 } 00055 k=k+1; 00056 m=operacionrampa*contador; 00057 lcd.cls(); 00058 lcd.locate(0,0); 00059 lcd.printf("%.3f",m); 00060 wait(m); 00061 // wait(1); 00062 } 00063 00064 00065 } 00066 00067 }
Generated on Wed Dec 21 2022 02:36:09 by
1.7.2