Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. //librerias
  2. #include <Stepper.h>
  3.  
  4. int led=12;
  5. int led1=11;
  6. int led2=10;
  7.  
  8. // Motores Paso a Paso
  9. const int motorX = 140; //(M8=>Paso:1,43mm; 360/1,43=>1mm=252º; 252ºpormm/0,9ºpor paso=280 Pasos por 1mm
  10. const int motorY = 140; //(M8=>Paso:1,43mm; 360/1,43=>1mm=252º; 252ºpormm/1.8ºpor paso=140 Pasos por 1mm
  11. const int motorZ = 140; //(M8=>Paso:1,43mm; 360/1,43=>1mm=252º; 252ºpormm/1.8ºpor paso=140 Pasos por 1mm
  12.  
  13. // initialize the stepper library on pins 8 through 11:
  14. Stepper mymotorX(motorX, 2,3);  
  15. Stepper mymotorY(motorY, 4,5);
  16. Stepper mymotorZ(motorZ, 6,7);
  17.  
  18. // ARREGLO Y VARIABLES LECTURA DE PROCESSING PARA SERVOS
  19. int MOTORX=0, MOTORY=0, MOTORZ=0;
  20. int motor[3] = {MOTORX, MOTORY, MOTORZ};
  21. //int antbase=90, anthombro=86, antcodo=150, antmuneca=45, antgiro=157, antgripper=175;
  22.  
  23. // byte lector
  24. int inByte, x, m, b, h, j, z;
  25. int k=0;
  26.  
  27. void setup() {
  28.  
  29.   pinMode(led,OUTPUT);
  30.   pinMode(led1,OUTPUT);
  31.   pinMode(led2,OUTPUT);
  32.  
  33.   // set the speed at 60 rpm:
  34.   mymotorX.setSpeed(150);
  35.   mymotorY.setSpeed(150);
  36.   mymotorZ.setSpeed(100);
  37.  
  38.   // initialize the serial port:
  39.   Serial.begin(9600);
  40. }
  41.  
  42. void loop() {
  43.  
  44. }
  45.  
  46. void serialEvent(){
  47.    if (Serial.available() > 0){
  48.     inByte = Serial.read();
  49.     if(inByte == 'M')
  50.       modo_manual();
  51.    }
  52. }