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.
Diff: main.cpp
- Revision:
- 4:136a0aeb7d51
- Parent:
- 3:ed8f41c75a80
- Child:
- 5:ee733f4b9ea7
diff -r ed8f41c75a80 -r 136a0aeb7d51 main.cpp
--- a/main.cpp Fri Feb 22 18:30:06 2019 +0000
+++ b/main.cpp Fri Feb 22 18:44:32 2019 +0000
@@ -27,17 +27,23 @@
// definición de las funciones
void setup_uart();
void setup_servo();
+
void mover_servo(uint8_t motor, uint8_t gradss);
+uint32_t degrees2usec(uint8_t grados){
+
void leer_datos();
+
+
int main() {
setup_uart();
setup_servo();
+ //command.printf("inicio de programa");
while(1){
leer_datos();
mover_servo(N_motor, N_grados);
-}
+ }
}
@@ -59,6 +65,22 @@
}
+
+
+void mover_servo(uint8_t motor, uint8_t grados){
+
+ uint32_t dpulse=0;
+
+/* complementar el código necesario
+ tip: deben pasar grados a microsegundo */
+
+
+// dpulse=degrees2usec(grados);
+// myservo1.pulsewidth_us(dpulse);
+
+}
+
+
uint32_t degrees2usec(uint8_t grados){
// Retorno el valor en usegundos, donde
// y − y1 = m(x − x1 )
@@ -66,20 +88,4 @@
return int(750+grados*1900/180);// u6
return 750;
-}
-
-void mover_servo(uint8_t motor, uint8_t grados){
-
-/*
-complementar el códogo necesario
-tip: deben pasar grados a microsegundo
- se genera in ejemplo con un servo
-
-*/
- uint32_t dpulse=degrees2usec(grados);
- //dpulse= degrees2sec(grados)
- myservo1.pulsewidth_us(dpulse);
-
- }
-
-
+}
\ No newline at end of file