Making my own class

Yes, I compiled it and I get some error message that I am currently trying to sort out.

Like complaints about missing semicolons?

I am going to create 16 of these objects

Why does the number of instances of the class affect whether you create global objects?

  • 22 other objects in my sketch hence i would like to move every test sketch i have made to its own class instead of copying it in 38 times.

You lost me.

So whats the best way to define constant for an object

As a class member.

and the second thing how can I make constant shared between objects

The member would be static (part of the class, not part of an instance of the class).

but still define them when i create the object?

I don’t understand this. You either want to define storage space on a per instance basis (non-static) or on a per-class basis (static). If you don’t use static, you need to initialize the variable in the constructor. If you do use static, you can initialize the variable in the header file.

So when I create the object I want to initialize these CONSTANT that never changes in my update method

This doesn’t make sense. Constants don’t change, so talk of initializing them in a method doesn’t make sense.

So all these CONSTANT should be only constants for that object

Make up your mind. They are either constant for the class or constant for the instances. In neither case should (or could) they be global.

but MAX_WATT and PULSE_FACTOR could be shared across objects, if they are not given as input the constructor for the objects.

This is not an either/or situation. Either the variables belong to the class (are shared by all instances) or they belong to each instance. You can’t have the a value shared by only some instances.

You can have default values for non-shared instances, but that doesn’t seem to be where you are trying to go.

the official class tutorial for arduino does not threat constants at all

Your issues have nothing to do with constants. They have to do with understanding, or not, static vs. instance variables.