servo 1

Dependencies:   mbed

El siguiente programa muestra el proceso de la configuracion del piccolo , el cual debera realizar unos graficos que seran ingresados por el usuario.

Primero necesitamos agregar las librerias necesarias para la ejecucion de las instrucciones

Luego configuramos los puertos que se van a implementar para las señales: PwmOut myServoX(PB_3); PwmOut myServoY(PB_4); PwmOut myServoZ(PB_5);

Necesitamos leer los bits : void put_sstime(uint32_t vtime) { s_time = vtime; }

Detectar los datos ingresados para generar su movimiento en microsegundos: void vertex2d(uint32_t x, uint32_t y) { int pulseX = coord2us(x); int pulseY = coord2us(y);

myServoX.pulsewidth_us(pulseX); myServoY.pulsewidth_us(pulseY); sstime(x,y); }

Colocamos un estado en reposo hasta que llegue los datos a ejecutar: void home () { nodraw (); vertex2d ( 0,0 ); }

los otros estados seria dibujar(draw) y no dibujar(nodraw): void draw () ; { myServoZ.pulsewidth_us (POSDRAW); wait_ms (ss_time * 2 ); }

void nodraw () ; { myServoZ.pulsewidth_us (MAXPOS); wait_ms (ss_time * 2 ); }

necesitamos al momento de realizar su funcion, guardar las instrucciones de modo que necesitamos configurar los datos de memoria

El sistema sera ejecutado remotamente de modo que necesitamos una conectividad inalambrica. Implementando un sistema de comunicacion Serial (Bluetooth).

Committer:
albeiro
Date:
Thu Feb 15 02:25:35 2018 +0000
Revision:
0:3aa0eba57875
servo 1

Who changed what in which revision?

UserRevisionLine numberNew contents of line
albeiro 0:3aa0eba57875 1 #include "mbed.h"
albeiro 0:3aa0eba57875 2
albeiro 0:3aa0eba57875 3 PwmOut mypwm(PWM_OUT);
albeiro 0:3aa0eba57875 4
albeiro 0:3aa0eba57875 5 DigitalOut myled(LED1);
albeiro 0:3aa0eba57875 6
albeiro 0:3aa0eba57875 7 int main() {
albeiro 0:3aa0eba57875 8
albeiro 0:3aa0eba57875 9 mypwm.period_ms(10);
albeiro 0:3aa0eba57875 10 mypwm.pulsewidth_us(200);
albeiro 0:3aa0eba57875 11
albeiro 0:3aa0eba57875 12
albeiro 0:3aa0eba57875 13 while(1) {
albeiro 0:3aa0eba57875 14 myled = !myled;
albeiro 0:3aa0eba57875 15 wait(1);
albeiro 0:3aa0eba57875 16 }
albeiro 0:3aa0eba57875 17 }