Dancing Tito 3D Printing Porject

Hello, so as a student me and my team are working on this school project call the dancing tito, it is a small 3D printed robot that is suppose to dance and move to the code that was given, however, the code that as provided had some errors that we're trying to figure out. It seems like the very last line of code is always an error no matter what we type to correct it.

At first it was the library, but one we have downloaded that and upload it, it seems like the code still refuse to work. Can we get some assistance on this project?

Website Link to Project: https://wikifactory.com/+OttoDIY/tito
Written Code:
#include <Adafruit_CircuitPlayground.h>
#include <Adafruit_Circuit_Playground.h>

#include <Servo.h>
#include <Oscillator.h>
#include <Otto.h>

Otto.h Otto; // This is Otto!

byte leftLeg = 2;
byte rightLeg = 3;
byte leftFoot = 4;
byte rightFoot= 5;
byte buzzer = 12;
byte trigPin = 8;
byte echoPin = 9;

// Variables for dancing routine
bool obstacleDetected = false;
int distance = 0;

// forward declarations
void danceParty();

void setup() {
// put your setup code here, to run once:
Otto.init(leftLeg, rightLegt, leftFoot, rightFoot, false, 0, buzzer, trigPin, echoPin);

Otto.home(); // reset servo positions

delay(50);
}

void loop() {
// put your main code here, to run repeatedly:

distance = Otto.getDistance();

if(distance < 200); {
danceParty();
} else {

}
}

void danceParty(){

Otto.walk(3, 1000, 1); // walk 3 steps
delay(300);
Otto.home();

Otto.playGesture(OttoHappy); // be happy
delay(50);

Otto.turn(2, 800, 1); // turn left
delay(50);

Otto.moonwalker(3, 800, 25, 1); // moonwalk it out!
Otto.home();

Otto.playGesture(OttoLove); // bow chikka wowow
delay(50);

Otto.turn(2, 800, -1); // turn right
delay(50);

Otto.jump(1,2000); // J U M P
Otto.home();

}

Library Links: Otto DIY · GitHub

Your topic was MOVED to its current forum category as it is more suitable than the original

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

Hello @student2022, can you show the error message ?

That's unusual.

Please use the "copy error messages" and post the results in code tags

If you look at the examples in the library you will find :

Otto Otto;  //This is Otto!

And in your code you replace it by :

Otto.h Otto; // This is Otto!

Maybe you can try to delete ".h" in the line 18.

@student2022 this is how you add the library :
image
It's from the github link in your post.

When deleting the ".h" the line of code that defines the legs and foot becomes undefine.

Post that version.

Arduino: 1.8.10 (Windows 10), Board: "Arduino Uno WiFi" 

In file included from C:\Users\student\Documents\Arduino\Dancing_Otto_Code\Dancing_Otto_Code.ino:4:0:

C:\Program Files (x86)\Arduino\libraries\Servo\src/Servo.h:86:0: warning: "MAX_SERVOS" redefined

 #define MAX_SERVOS   (_Nbr_16timers  * SERVOS_PER_TIMER)

 

In file included from C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground/utility/CP_Firmata.h:17:0,

                 from C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground/Adafruit_Circuit_Playground.h:25,

                 from C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground/Adafruit_CircuitPlayground.h:3,

                 from C:\Users\student\Documents\Arduino\Dancing_Otto_Code\Dancing_Otto_Code.ino:1:

C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground/utility/CP_Boards.h:32:0: note: this is the location of the previous definition

 #define MAX_SERVOS 0

 

Dancing_Otto_Code:8:5: error: expected unqualified-id before '.' token

 Otto.h Otto; // This is Otto!

     ^

C:\Users\student\Documents\Arduino\Dancing_Otto_Code\Dancing_Otto_Code.ino: In function 'void setup()':

Dancing_Otto_Code:27:7: error: expected unqualified-id before '.' token

   Otto.init(leftLeg, rightLegt, leftFoot, rightFoot, false, 0, buzzer, trigPin, echoPin);

       ^

Dancing_Otto_Code:29:7: error: expected unqualified-id before '.' token

   Otto.home(); // reset servo positions

       ^

C:\Users\student\Documents\Arduino\Dancing_Otto_Code\Dancing_Otto_Code.ino: In function 'void loop()':

Dancing_Otto_Code:37:18: error: expected primary-expression before '.' token

   distance = Otto.getDistance();

                  ^

Dancing_Otto_Code:41:5: error: 'else' without a previous 'if'

   } else {

     ^~~~

C:\Users\student\Documents\Arduino\Dancing_Otto_Code\Dancing_Otto_Code.ino: In function 'void danceParty()':

Dancing_Otto_Code:48:7: error: expected unqualified-id before '.' token

   Otto.walk(3, 1000, 1); // walk 3 steps

       ^

Dancing_Otto_Code:50:7: error: expected unqualified-id before '.' token

   Otto.home();

       ^

Dancing_Otto_Code:52:7: error: expected unqualified-id before '.' token

   Otto.playGesture(OttoHappy); // be happy

       ^

Dancing_Otto_Code:55:7: error: expected unqualified-id before '.' token

   Otto.turn(2, 800, 1); // turn left

       ^

Dancing_Otto_Code:58:7: error: expected unqualified-id before '.' token

   Otto.moonwalker(3, 800, 25, 1); // moonwalk it out!

       ^

Dancing_Otto_Code:59:7: error: expected unqualified-id before '.' token

   Otto.home();

       ^

Dancing_Otto_Code:61:7: error: expected unqualified-id before '.' token

   Otto.playGesture(OttoLove); // bow chikka wowow

       ^

Dancing_Otto_Code:64:7: error: expected unqualified-id before '.' token

   Otto.turn(2, 800, -1); // turn right

       ^

Dancing_Otto_Code:67:7: error: expected unqualified-id before '.' token

   Otto.jump(1,2000); // J U M P

       ^

Dancing_Otto_Code:68:7: error: expected unqualified-id before '.' token

   Otto.home();

       ^

Multiple libraries were found for "Servo.h"
 Used: C:\Program
Multiple libraries were found for "Oscillator.h"
 Used: C:\Users\student\Documents\Arduino\libraries\OttoDIYLib-master
Multiple libraries were found for "EEPROM.h"
 Used: C:\Program
Multiple libraries were found for "SoftwareSerial.h"
 Used: C:\Program
Multiple libraries were found for "Adafruit_CircuitPlayground.h"
 Used: C:\Program
Multiple libraries were found for "Wire.h"
 Used: C:\Program
Multiple libraries were found for "SPI.h"
 Used: C:\Program
exit status 1
expected unqualified-id before '.' token

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I meant post the code.

the code with the new undefine error?

Yes.

If you have a leftLeg, why have you got a rightLegt?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.