visser:
(Are templates used here?)
You can use templates. This is C++.
Now, when a motor is set to a certain speed or direction. I want that value to be stored in an object.
I don't want to seem obtuse, but I don't get this bit. You set the motor to a speed. So yes you can store that speed.
Now once it is stored, the value needs to be accessed later as a condition for, a switch or if -statement.
Naturally, or there isn't much point in storing it.
Now I know this can be simply done using a float as storage for the value.
True.
But I want to know, now, if there is any other way to do this?
Another, more complicated, way? Sure, but why bother?
I suspect you are coming from a world, a world that I have largely left behind me. In this world you download megabytes of libraries to do things in very fancy general ways. I bet you could use these libraries to store the data, serve it up on an HTML page, save it to a database, email it to your brother, and then send it to Twitter.
But we don't need all that complexity ... do we?
Keep it simple ...
float speed = 42;
float direction = 220;
Done.