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 01-04EntregaPrimerCorte by
Diff: mover.cpp
- Revision:
- 2:dc3183a4bdf4
- Parent:
- 1:526bdd5faa37
--- a/mover.cpp Tue Sep 04 02:15:49 2018 +0000
+++ b/mover.cpp Sun Sep 30 21:17:00 2018 +0000
@@ -9,7 +9,7 @@
PwmOut myServo3(PB_5);
-uint8_t ss_time=50; // tiempo de espera para moverse 1 mm en microsegundos
+uint8_t ss_time=180; // tiempo de espera para moverse 1 mm en microsegundos
void put_sstime(uint8_t vtime){
ss_time=vtime;
@@ -19,7 +19,7 @@
int coord2us(float coord)
{
if(0 <= coord <= MAXPOS)
- return int(750+coord*1900/50);// u6
+ return int(750+coord*1900/180);// u6
return 750;
}
@@ -31,9 +31,14 @@
void mover_ser(uint8_t motor, uint8_t pos){
int pulseX = coord2us(pos);
-
+ switch (motor){
+ case 0x01:
myServo1.pulsewidth_us(pulseX);
-
+ break;
+ case 0x02:
+ myServo2.pulsewidth_us(pulseX);
+ break;
+ }
}
@@ -42,6 +47,9 @@
myServo1.period_ms(20);
myServo2.period_ms(20);
myServo3.period_ms(20);
-
-
+ myServo4.period_ms(20);
+ myServo5.period_ms(20);
+ myServo6.period_ms(20);
+ myServo7.period_ms(20);
+ myServo8.period_ms(20);
}
\ No newline at end of file
