final nnnn
Este proyecto es un Piccolo en el cual se envía comandos para la realización de un dibujo en especifico. El programa va a controlar servos y motores paso a paso teniendo libertad de movimiento en los ejes X,Y,Z; En el programa se utiliza Comunicacion Serial (TX,RX) y para leer el dato fue necesario concatenarlo debido a que recibe 8 Bits pero tenemos que recibir 4 paquetes de 8 Bits para llegar a 32 Bits y poder asi leerlo.
Se estan implementando algunas librerias para su ejecucion como la #include "memory.h" que es de memoria, #include memory_array_h, tambien definimos la memoria #define mm_size 10 de tipo Type Uint32_t, la libreria de operaciones #include "math.h" y la libreria para los motores #include "stepmotor.h".
Para su ejecucion se crearon variables de ejecucion:
CM_DRAWING 0XFF: Se ejecuta siempre y cuando exista datos validos para leer de memoria y nos muestra por medio de un mensaje que se esta ejecutando el dibujo
CM_SAVING 0XFE: Inicia el comando de guardar
CM_VERTEX2D 0XFD: Se encarga de dar las coordenadas a los servomotores en X,Y.
CM_DRAW 0XFC: Se encarga de mover nuestro motor en Z
CM_NODRAW 0XFB: Su funcion es volver a la posicion inicial el motor en el eje Z
CM_MOTOR 0XF9: Se encarga de mover los motores paso a paso para llegar a la ubicacion asignada ingresando el Numero de cuadrantes y su sentido de giro.
stepmotor.h@2:14fcd29abee0, 2018-04-26 (annotated)
- Committer:
- ANTONIO_VARGAS
- Date:
- Thu Apr 26 01:48:40 2018 +0000
- Revision:
- 2:14fcd29abee0
- Parent:
- 0:0119b611fc51
explicacion programa piccolo
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ANTONIO_VARGAS | 0:0119b611fc51 | 1 | |
ANTONIO_VARGAS | 0:0119b611fc51 | 2 | |
ANTONIO_VARGAS | 0:0119b611fc51 | 3 | #ifndef STEP_MOTOR_H |
ANTONIO_VARGAS | 0:0119b611fc51 | 4 | #define STEP_MOTOR_H |
ANTONIO_VARGAS | 0:0119b611fc51 | 5 | |
ANTONIO_VARGAS | 0:0119b611fc51 | 6 | #include "mbed.h" |
ANTONIO_VARGAS | 0:0119b611fc51 | 7 | |
ANTONIO_VARGAS | 0:0119b611fc51 | 8 | class stepmotor { |
ANTONIO_VARGAS | 0:0119b611fc51 | 9 | public: |
ANTONIO_VARGAS | 0:0119b611fc51 | 10 | |
ANTONIO_VARGAS | 0:0119b611fc51 | 11 | stepmotor(PinName in1, PinName in2, PinName in3, PinName in4); |
ANTONIO_VARGAS | 0:0119b611fc51 | 12 | void step(uint32_t num_steps,bool cw); |
ANTONIO_VARGAS | 0:0119b611fc51 | 13 | void set_speed(int speed); |
ANTONIO_VARGAS | 0:0119b611fc51 | 14 | uint32_t get_speed(); |
ANTONIO_VARGAS | 0:0119b611fc51 | 15 | private: |
ANTONIO_VARGAS | 0:0119b611fc51 | 16 | BusOut motor_out; |
ANTONIO_VARGAS | 0:0119b611fc51 | 17 | uint32_t motorSpeed; |
ANTONIO_VARGAS | 0:0119b611fc51 | 18 | int8_t nstep; |
ANTONIO_VARGAS | 0:0119b611fc51 | 19 | |
ANTONIO_VARGAS | 0:0119b611fc51 | 20 | void move(); |
ANTONIO_VARGAS | 0:0119b611fc51 | 21 | }; |
ANTONIO_VARGAS | 0:0119b611fc51 | 22 | |
ANTONIO_VARGAS | 0:0119b611fc51 | 23 | #endif |