Advertisement
nathmo

Fenir walk

Sep 25th, 2016
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.15 KB | None | 0 0
  1. /* Fenir
  2. Make walk a dog like robot.
  3. Wiring :
  4. ==========  ==========                    ==========  ==========
  5. =   6    =  =    7   =                    =   8    =  =   9    =
  6. ==========  ==========                    ==========  ==========
  7.                    =====                =====
  8.                    =   =                =   =
  9.                    = 2 =   ==========   = 1 =
  10.                    =   =   |ARDUINO |   =   =
  11.                    =====   |        |   =====
  12.  BACK                      |BATTERRY|                        FRONT
  13.                    =====   |        |   =====
  14.                    =   =   |        |   =   =
  15.                    = 3 =   ==========   = 0 =
  16.                    =   =                =   =
  17.                    =====                =====
  18. ==========  ==========                    ==========  ==========
  19. =    5   =  =    4   =                    =   11   =  =   10   =
  20. ==========  ==========                    ==========  ==========
  21. servo | PIN
  22.  
  23.    1  = 11
  24.    11 = 10
  25.    8  = 9
  26.    3  = 8
  27.    4  = 7
  28.    7  = 6
  29.    2  = 5
  30.    11 = 4
  31.    9  = 3
  32.    6  = 2
  33.    10 = 1
  34.    5  = 0
  35.    
  36.  
  37.  
  38. Coded (Edited/Pasted) by Nathann Morand on 09.2016
  39. natmo@hotmail.ch
  40. */
  41.  
  42. #include <Servo.h>
  43.  
  44. Servo FootRB;  // Foot stand for the extremety of the robot
  45. Servo FootRF;  // F for front, L for left
  46. Servo FootLB;  // R for Right and B for Back
  47. Servo FootLF;
  48. Servo LegRB;
  49. Servo LegRF;
  50. Servo LegLB;
  51. Servo LegLF;
  52. Servo ClavicleRB;
  53. Servo ClavicleRF;
  54. Servo ClavicleLB;
  55. Servo ClavicleLF;
  56.  
  57. #define FootRBPOSLaydown 0
  58. #define FootRFPOSLaydown 0
  59. #define FootLBPOSLaydown 0
  60. #define FootLFPOSLaydown 0
  61. #define LegRBPOSLaydown 0
  62. #define LegRFPOSLaydown 0
  63. #define LegLBPOSLaydown 0
  64. #define LegLFPOSLaydown 0
  65. #define ClavicleRBPOSLaydown 0
  66. #define ClavicleRFPOSLaydown 0
  67. #define ClavicleLBPOSLaydown 0
  68. #define ClavicleLFPOSLaydown 0
  69.  
  70. void setup()
  71. {
  72.   FootRB.attach(5);  // attaches the servo on the pin
  73.   FootRF.attach(1);
  74.   FootLB.attach(2);
  75.   FootLF.attach(3);
  76.   LegRB.attach(7);
  77.   LegRF.attach(10);
  78.   LegLB.attach(6);
  79.   LegLF.attach(9);
  80.   ClavicleRB.attach(8);
  81.   ClavicleRF.attach(0);
  82.   ClavicleLB.attach(4);
  83.   ClavicleLF.attach(11);
  84. }
  85. void Wake()
  86. {
  87.   //put the dog in the laydown position if not
  88.   FootRB.write(FootRBPOSLaydown);
  89.   FootRF.write(FootRFPOSLaydown);
  90.   FootLB.write(FootLBPOSLaydown);
  91.   FootLF.write(FootLFPOSLaydown);
  92.   LegRB.write(LegRBPOSLaydown);
  93.   LegRF.write(LegRFPOSLaydown);
  94.   LegLB.write(LegLBPOSLaydown);
  95.   LegLF.write(LegLFPOSLaydown);
  96.   ClavicleRB.write(ClavicleRBPOSLaydown);
  97.   ClavicleRF.write(ClavicleRFPOSLaydown);
  98.   ClavicleLB.write(ClavicleLBPOSLaydown);
  99.   ClavicleLF.write(ClavicleLFPOSLaydown);
  100.   //move the front
  101.   delay(1000);
  102.   FootRF.write(ClavicleLFPOSLaydown -90);
  103.   FootLF.write(ClavicleRFPOSLaydown -90);
  104.   delay(50);
  105.   LegRF.write(LegRFPOSLaydown-90);
  106.   LegLF.write(LegLFPOSLaydown-90);
  107.   /*
  108.   FootLB.write();
  109.   FootRB.write();
  110.   LegRB.write();
  111.   LegRF.write();
  112.   LegLB.write();
  113.   LegLF.write();
  114.   ClavicleRB.write();
  115.   ClavicleRF.write();
  116.   ClavicleLB.write();
  117.   ClavicleLF.write();
  118.   */
  119.     //implémenter le gyroscope, verifier les timing
  120. }
  121. void loop()
  122. {
  123.   Wake();
  124. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement