Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8168131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:25:09+00:00 2026-06-06T20:25:09+00:00

I am having some trouble with writing classes in Arduino. Here is a class

  • 0

I am having some trouble with writing classes in Arduino. Here is a class called “Jerry.” It contains three instances of user-defined classes called Mouth, Move, and Injection. The Arduino IDE complains ‘Mouth’ does not name a type, and ‘Move’ does not name a type. How can I make Arduino recognize Mouth and Move as valid types?

   #ifndef JERRY_H
   #define JERRY_H
   include "Button.h"
   include "Injection.h"

   class Jerry 
   {

        protected:
            int BGL;
            double protein_conc;

        public:
            Jerry(int, int);
            Mouth mth;
            Move mv;
            Injection inj;
            volatile long prev_interrupt_time;
   };

   #endif // JERRY_H

(# signs removed because it screws up the formatting in StackOverflow)

The Mouth, Move, and Injection class declarations are below:

    #ifndef BUTTON_H
    #define BUTTON_H
    include "Jerry.h"

    class Button
    {
        public:
            void setPin(int);
            int getPin();
            bool check(Jerry);
            virtual void run();
        protected:
            int pin;
   };

    class Mouth : public Button
    {
        public:
            int detectFood();
            void run();
    };

    class Move : public Button
    {
        public:
            bool checkLaughing();
            void runLaughing();
            bool checkSleep();
    };

    #endif // BUTTON_H

    #ifndef INJECTION_H
    #define INJECTION_H


    class Injection
    {
         public:
            void setPin(int, int, int, int);
            void checkInjection(); 

            void checkInjectionSite(); 
         protected:
            int pin1;
            int pin2;
            int pin3;
            int pin4;
    };

    #endif // INJECTION_H

any help would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T20:25:11+00:00Added an answer on June 6, 2026 at 8:25 pm

    It looks like you need to set it up like libraries/Jerry/Jerry.h and libraries/Button/Button.h in the same folder as your sketch.

    Check out:
    http://arduino.cc/en/Hacking/LibraryTutorial

    First, make a Morse directory inside of the libraries sub-directory of
    your sketchbook directory. Copy or move the Morse.h and Morse.cpp
    files into that directory. Now launch the Arduino environment. If you
    open the Sketch > Import Library menu, you should see Morse inside.
    The library will be compiled with sketches that use it. If the library
    doesn’t seem to build, make sure that the files really end in .cpp and
    .h (with no extra .pde or .txt extension, for example). Let’s see how
    we can replicate our old SOS sketch using the new library:

    #include <Morse.h>
    
    Morse morse(13);
    
    void setup()
    {
    }
    
    void loop()
    {
      morse.dot(); morse.dot(); morse.dot();
      morse.dash(); morse.dash(); morse.dash();
      morse.dot(); morse.dot(); morse.dot();
      delay(3000);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having some trouble writing a correct algorithm for centering a background image. Here's
I'm having some trouble writing a hashCode() method for a class I created. This
I'm having some trouble writing a query using variables. Here's my code Dim bondnumber
Im having some trouble writing a getstring function, this is what I have so
I am having some trouble with writing a unit test that checks my custom
I'm new to linq and having trouble writing two simple queries. For some reason,
I'm having some trouble writing a function to change a background image on a
I'm having some trouble writing a jQuery function and could use a little help.
I'm writing a recursive function in JS and having some trouble. Let's start with
I'm writing a news-app and I'm having some trouble with displaying a custom list.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.