Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. #include <Servo.h>
  2. #include <ALLBOT.h>
  3.  
  4. ALLBOT AURA(8); //number of motors
  5.  
  6. enum MotorName {
  7. hipFrontLeft,
  8. hipFrontRight,
  9. hipRearLeft,
  10. hipRearRight,
  11. kneeFrontLeft,
  12. kneeFrontRight,
  13. kneeRearLeft,
  14. kneeRearRight
  15. };
  16.  
  17. // where is this pin??
  18. int sounderPin = 13;
  19.  
  20. void chirp(int beeps, int speedms){
  21. for (int i = 0; i < beeps; i++){
  22. for (int i = 0; i < 255; i++){
  23. digitalWrite(sounderPin, HIGH);
  24. delayMicroseconds((355-i) + (speedms*2));
  25. digitalWrite(sounderPin, LOW);
  26. delayMicroseconds((355-i) + (speedms*2));
  27. }
  28. delay(30);
  29. }
  30. }
  31.  
  32. void chorp(int beeps, int speedms){
  33. for (int i = 0; i < beeps; i++){
  34. for (int i = 100; i < 255; i++){
  35. digitalWrite(sounderPin, HIGH);
  36. delayMicroseconds((355-i) + (speedms));
  37. digitalWrite(sounderPin, LOW);
  38. delayMicroseconds((355-i) + (speedms));
  39. }
  40. for (int i = 510; i > 0; i--){
  41. digitalWrite(sounderPin, HIGH);
  42. delayMicroseconds((710-i) + (speedms*2));
  43. digitalWrite(sounderPin, LOW);
  44. delayMicroseconds((710-i) + (speedms*20));
  45. }
  46. delay(30);
  47. }
  48. }
  49.  
  50. void setup() {
  51.  
  52. Serial.begin(9600);
  53.  
  54. // NAME.attach(motorname, pin, init-angle, flipped, offset-angle);
  55. AURA.attach(hipFrontLeft, A1, 45, 0, 0);
  56. AURA.attach(hipFrontRight, A0, 45, 1, 0);
  57. AURA.attach(hipRearLeft, 9, 45, 1, 0);
  58. AURA.attach(hipRearRight, 4, 45, 0, 0);
  59. //
  60. AURA.attach(kneeFrontLeft, 11, 45, 1, 0);
  61. AURA.attach(kneeFrontRight, 2, 45, 0, 0);
  62. AURA.attach(kneeRearLeft, 10, 45, 1, 0);
  63. AURA.attach(kneeRearRight, 3, 45, 0, 0);
  64.  
  65. // what is OUTPUT ??
  66. // INIT sounder
  67. pinMode(sounderPin, OUTPUT);
  68.  
  69. delay(500);
  70.  
  71. chirp(1, 0);
  72. chorp(1, 35);
  73. // chirp(1, 255);
  74. // chirp(3, 0);
  75. }
  76.  
  77. void loop() {
  78. // put your main code here, to run repeatedly:
  79.  
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement