I have problem with code

If I add this code to arduino it will print a compilation error for the Arduino Nano board.

there is code :

//-- Otto Humanoid V10

#ifndef OttoHumanoid_h
#define OttoHumanoid_h

#ifdef ARDUINO_ARCH_ESP32
#include <ESP32Servo.h>
#else
#include <Servo.h>
#endif
#include <Oscillator.h>
#include <EEPROM.h>
#include <US.h>

#include "Otto_matrix.h"
#include "Otto_mouths.h"
#include "Otto_sounds.h"
#include "Otto_gestures.h"

//-- Constants
#define FORWARD     1
#define BACKWARD    -1
#define LEFT        1
#define RIGHT       -1
#define SMALL       5
#define MEDIUM      15
#define BIG         30

class OttoHumanoid
{
  public:

    //-- Otto initialization
    void initHUMANOID(int YL, int YR, int RL, int RR,int LA, int RA, bool load_calibration, int NoiseSensor, int Buzzer, int USTrigger, int USEcho);
    void initDC(int NoiseSensor, int Buzzer, int USTrigger, int USEcho);
    //-- Attach & detach functions
    void attachServos();
    void detachServos();

    //-- Oscillator Trims
    void setTrims(int YL, int YR, int RL, int RR,int LA, int RA);
    void saveTrimsOnEEPROM();

    //-- Predetermined Motion Functions
    void _moveServos(int time, int  servo_target[]);
    void oscillateServos(int A[6], int O[6], int T, double phase_diff[6], float cycle);

    //-- HOME = Otto at rest position
    void home();
    bool getRestState();
    void setRestState(bool state);
    
    //-- Predetermined Motion Functions
    void jump(float steps=1, int T = 2000);

    void walk(float steps=4, int T=1000, int dir = FORWARD);
    void turn(float steps=4, int T=2000, int dir = LEFT);
    void bend (int steps=1, int T=1400, int dir=LEFT);
    void shakeLeg (int steps=1, int T = 2000, int dir=RIGHT);

    void updown(float steps=1, int T=1000, int h = 20);
    void swing(float steps=1, int T=1000, int h=20);
    void tiptoeSwing(float steps=1, int T=900, int h=20);
    void jitter(float steps=1, int T=500, int h=20);
    void ascendingTurn(float steps=1, int T=900, int h=20);

    void moonwalker(float steps=1, int T=900, int h=20, int dir=LEFT);
    void crusaito(float steps=1, int T=900, int h=20, int dir=FORWARD);
    void flapping(float steps=1, int T=1000, int h=20, int dir=FORWARD);
    void armsup();
    void armsdown();
    void armwave(int dir =RIGHT);

    //-- Sensors functions
    float getDistance(); //US sensor
    int getNoise();      //Noise Sensor
    
    //-- Mouth & Animations
    void putMouth(unsigned long int mouth, bool predefined = true);
    void putAnimationMouth(unsigned long int anim, int index);
    void clearMouth();

    //-- Sounds
    void _tone (float noteFrequency, long noteDuration, int silentDuration);
    void bendTones (float initFrequency, float finalFrequency, float prop, long noteDuration, int silentDuration);
    void sing(int songName);

    //-- Gestures
    void playGesture(int gesture);
    void initMATRIX(int DIN, int CS, int CLK, int rotate);
    void matrixIntensity(int intensity);
    void setLed(byte X, byte Y, byte value);
    void writeText (const char * s, byte scrollspeed);
  private:
   
    Oscillator servo[6];
    US us;
    Otto_Matrix ledmatrix;
    int servo_pins[6];
    int servo_trim[6];
    int servo_position[6];
  int set_A[6];
  int set_O[6];
  double set_phase_diff[6];

    int pinBuzzer;
    int pinNoiseSensor;
    
    unsigned long final_time;
    unsigned long partial_time;
    float increment[6];

    bool isOttoResting;
    bool isHUMANOID;

    unsigned long int getMouthShape(int number);
    unsigned long int getAnimShape(int anim, int index);
    void _execute(int A[6], int O[6], int T, double phase_diff[6], float steps);

};

#endif

and print this eror:
C:\Users\Uzivatel\AppData\Local\Temp\ccbO2rRA.ltrans0.ltrans.o: In function main': D:\firda\Arduino\hardware\arduino\avr\cores\arduino/main.cpp:43: undefined reference to setup'
D:\firda\Arduino\hardware\arduino\avr\cores\arduino/main.cpp:46: undefined reference to `loop'
collect2.exe: error: ld returned 1 exit status
exit status 1
Nastala chyba pri kompilácii pre dosku Arduino Nano.

Someone know help my ?

Hi @daveesk
you have a problem with the code, and we have a problem with your post.

How about solving our problem by reading:
How to get the best out of this forum

and then redo your initial topic by putting the code and printout in </> tags?
ArduinoForum

Your post was MOVED to its current location as it is more suitable

As with your other topic the problem is that you have no setup() and loop() function in your sketch

You don’t need to do this with an Arduino the IDE will do it for you.

He's defining a class. The compiler will NOT create prototype for class member functions...

Who knew? Have you seen more of his “code”?

Did you miss the above?

If I enter this code in Arduino, it will print an error when compiling it with the Arduino Nano board. Someone know help me ?

there is code:

//-- Otto Humanoid V10

#ifndef OttoHumanoid_h
#define OttoHumanoid_h

#ifdef ARDUINO_ARCH_ESP32
#include <ESP32Servo.h>
#else
#include <Servo.h>
#endif
#include <Oscillator.h>
#include <EEPROM.h>
#include <US.h>

#include "Otto_matrix.h"
#include "Otto_mouths.h"
#include "Otto_sounds.h"
#include "Otto_gestures.h"

//-- Constants
#define FORWARD     1
#define BACKWARD    -1
#define LEFT        1
#define RIGHT       -1
#define SMALL       5
#define MEDIUM      15
#define BIG         30

class OttoHumanoid
{
  public:

    //-- Otto initialization
    void initHUMANOID(int YL, int YR, int RL, int RR,int LA, int RA, bool load_calibration, int NoiseSensor, int Buzzer, int USTrigger, int USEcho);
    void initDC(int NoiseSensor, int Buzzer, int USTrigger, int USEcho);
    //-- Attach & detach functions
    void attachServos();
    void detachServos();

    //-- Oscillator Trims
    void setTrims(int YL, int YR, int RL, int RR,int LA, int RA);
    void saveTrimsOnEEPROM();

    //-- Predetermined Motion Functions
    void _moveServos(int time, int  servo_target[]);
    void oscillateServos(int A[6], int O[6], int T, double phase_diff[6], float cycle);

    //-- HOME = Otto at rest position
    void home();
    bool getRestState();
    void setRestState(bool state);
    
    //-- Predetermined Motion Functions
    void jump(float steps=1, int T = 2000);

    void walk(float steps=4, int T=1000, int dir = FORWARD);
    void turn(float steps=4, int T=2000, int dir = LEFT);
    void bend (int steps=1, int T=1400, int dir=LEFT);
    void shakeLeg (int steps=1, int T = 2000, int dir=RIGHT);

    void updown(float steps=1, int T=1000, int h = 20);
    void swing(float steps=1, int T=1000, int h=20);
    void tiptoeSwing(float steps=1, int T=900, int h=20);
    void jitter(float steps=1, int T=500, int h=20);
    void ascendingTurn(float steps=1, int T=900, int h=20);

    void moonwalker(float steps=1, int T=900, int h=20, int dir=LEFT);
    void crusaito(float steps=1, int T=900, int h=20, int dir=FORWARD);
    void flapping(float steps=1, int T=1000, int h=20, int dir=FORWARD);
    void armsup();
    void armsdown();
    void armwave(int dir =RIGHT);

    //-- Sensors functions
    float getDistance(); //US sensor
    int getNoise();      //Noise Sensor
    
    //-- Mouth & Animations
    void putMouth(unsigned long int mouth, bool predefined = true);
    void putAnimationMouth(unsigned long int anim, int index);
    void clearMouth();

    //-- Sounds
    void _tone (float noteFrequency, long noteDuration, int silentDuration);
    void bendTones (float initFrequency, float finalFrequency, float prop, long noteDuration, int silentDuration);
    void sing(int songName);

    //-- Gestures
    void playGesture(int gesture);
    void initMATRIX(int DIN, int CS, int CLK, int rotate);
    void matrixIntensity(int intensity);
    void setLed(byte X, byte Y, byte value);
    void writeText (const char * s, byte scrollspeed);
  private:
   
    Oscillator servo[6];
    US us;
    Otto_Matrix ledmatrix;
    int servo_pins[6];
    int servo_trim[6];
    int servo_position[6];
  int set_A[6];
  int set_O[6];
  double set_phase_diff[6];

    int pinBuzzer;
    int pinNoiseSensor;
    
    unsigned long final_time;
    unsigned long partial_time;
    float increment[6];

    bool isOttoResting;
    bool isHUMANOID;

    unsigned long int getMouthShape(int number);
    unsigned long int getAnimShape(int anim, int index);
    void _execute(int A[6], int O[6], int T, double phase_diff[6], float steps);

};

#endif

there is error:
C:\Users\Uzivatel\AppData\Local\Temp\ccbUJeTe.ltrans0.ltrans.o: In function main': D:\firda\Arduino\hardware\arduino\avr\cores\arduino/main.cpp:43: undefined reference to setup'
D:\firda\Arduino\hardware\arduino\avr\cores\arduino/main.cpp:46: undefined reference to `loop'
collect2.exe: error: ld returned 1 exit status
exit status 1
Nastala chyba pri kompilácii pre dosku Arduino Nano.

Your post was MOVED to its current location as it is more suitable

Welcome to the forum

You have no setup() and loop() function in your sketch, hence the errors

Where did you this code get from? This is only a header file, and surely much more is needed for a complete sketch/program.

From the official page to Otto Humanoid arduino robot ..... Also I have other cody, but I still have the same problem. Unfortunately, I am not proficient in this as I see what I have to learn. Don't you happen to have experience with the Otto humanoid robot?

No, I don't know nothing about this project. I can only see from the structure of the code you posted, that its a header file. It contains only declarations, no executable code. Those files are usually part of larger projects. You definitely need much more than that to get your robot running.

Hi @daveesk
Is it the same problem?
Please don't repeat posts.
Save our efforts.

I have merged your cross-posts @daveesk.

Cross-posting is against the rules of the forum. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend 15 minutes (or more) writing a detailed answer on this topic, without knowing that someone else already did the same in the other topic.

Repeated cross-posting will result in a suspension from the forum.

In the future, please take some time to pick the forum board that best suits the topic of your question and then only post once to that forum board. This is basic forum etiquette, as explained in the "How to get the best out of this forum" guide you will find at the top of every forum category. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

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