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.
main.cpp
00001 #include "mbed.h" 00002 00003 Serial pc(USBTX, USBRX); // tx, rx 00004 00005 DigitalOut dirAMotor(A4); 00006 PwmOut dirBMotor(A3); 00007 InterruptIn encoderA(A2); 00008 00009 int contador=0; 00010 00011 void encoderAIrq() 00012 { 00013 contador++; 00014 } 00015 00016 int main() 00017 { 00018 pc.baud(115200); 00019 encoderA.rise(&encoderAIrq); // attach the address of the flip function to the rising edge 00020 dirAMotor=0; 00021 while (true) { 00022 for (float i=0; i<1; i=i+0.01) { 00023 dirBMotor=i; 00024 wait(0.100); 00025 } 00026 pc.printf("Vueltas: %d\r\n",contador); 00027 contador=0; 00028 } 00029 }
Generated on Mon Jul 18 2022 08:29:04 by
