Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Servo.h>
- #include <ALLBOT.h>
- ALLBOT AURA(8); //number of motors
- enum MotorName {
- hipFrontLeft,
- hipFrontRight,
- hipRearLeft,
- hipRearRight,
- kneeFrontLeft,
- kneeFrontRight,
- kneeRearLeft,
- kneeRearRight
- };
- // where is this pin??
- int sounderPin = 13;
- void chirp(int beeps, int speedms){
- for (int i = 0; i < beeps; i++){
- for (int i = 0; i < 255; i++){
- digitalWrite(sounderPin, HIGH);
- delayMicroseconds((355-i) + (speedms*2));
- digitalWrite(sounderPin, LOW);
- delayMicroseconds((355-i) + (speedms*2));
- }
- delay(30);
- }
- }
- void chorp(int beeps, int speedms){
- for (int i = 0; i < beeps; i++){
- for (int i = 100; i < 255; i++){
- digitalWrite(sounderPin, HIGH);
- delayMicroseconds((355-i) + (speedms));
- digitalWrite(sounderPin, LOW);
- delayMicroseconds((355-i) + (speedms));
- }
- for (int i = 510; i > 0; i--){
- digitalWrite(sounderPin, HIGH);
- delayMicroseconds((710-i) + (speedms*2));
- digitalWrite(sounderPin, LOW);
- delayMicroseconds((710-i) + (speedms*20));
- }
- delay(30);
- }
- }
- void setup() {
- Serial.begin(9600);
- // NAME.attach(motorname, pin, init-angle, flipped, offset-angle);
- AURA.attach(hipFrontLeft, A1, 45, 0, 0);
- AURA.attach(hipFrontRight, A0, 45, 1, 0);
- AURA.attach(hipRearLeft, 9, 45, 1, 0);
- AURA.attach(hipRearRight, 4, 45, 0, 0);
- //
- AURA.attach(kneeFrontLeft, 11, 45, 1, 0);
- AURA.attach(kneeFrontRight, 2, 45, 0, 0);
- AURA.attach(kneeRearLeft, 10, 45, 1, 0);
- AURA.attach(kneeRearRight, 3, 45, 0, 0);
- // what is OUTPUT ??
- // INIT sounder
- pinMode(sounderPin, OUTPUT);
- delay(500);
- chirp(1, 0);
- chorp(1, 35);
- // chirp(1, 255);
- // chirp(3, 0);
- }
- void loop() {
- // put your main code here, to run repeatedly:
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement