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.
Fork of 00_LAB_STEPMOTOR by
Revision 2:1f5d8504b38d, committed 2018-04-11
- Comitter:
- ANTONIO_VARGAS
- Date:
- Wed Apr 11 00:52:00 2018 +0000
- Parent:
- 1:5dfedc044f7a
- Commit message:
- hhjh
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Mar 21 01:32:33 2018 +0000
+++ b/main.cpp Wed Apr 11 00:52:00 2018 +0000
@@ -1,23 +1,31 @@
#include "mbed.h"
#include "stepmotor.h"
+#define NSXC 4096
stepmotor smotor1(D9,D10,D11,D12);
Serial pc(USBTX,USBRX);
int main() {
+
+ //definir posicion central del servo
+
+
+
uint32_t speed=1500;
bool cw=true;
+
while(1)
{
smotor1.set_speed(speed);
- pc.printf("velocidad del motor: %i, %f rpm, CW=%d \n",smotor1.get_speed(), (60/((smotor1.get_speed()*4.096)/1000)),cw);
+ pc.printf("velocidad del motor: %i, %f rpm, CW=%d \n",smotor1.get_speed(), (60/((smotor1.get_speed()*4.096)/1000))cw);
- smotor1.step(4096,cw);
+ smotor1.step(cu*NSXC,sent);
- cw^=cw;
- speed=speed+200;
- if (speed > 10000)speed =1500;
+
+ speed=speed+1000;
+ if (speed > 9600)speed =1500;
+ cw=!cw;
wait(1);
}
}
