Linking to C++ includes, or having a Dictionary or List template?

liudr:

visser:
Ok here is what I am trying to achieve. :).

I have some motors. Now, when a motor is set to a certain speed or direction. I want that value to be stored in an object. (Are templates used here?) Now once it is stored, the value needs to be accessed later as a condition for, a switch or if -statement. Now I know this can be simply done using a float as storage for the value. But I want to know, now, if there is any other way to do this? (My original thought was the attribute system I created in c# and convert it to c++. :l)

(Did I explain it well enough? :roll_eyes:)

That was pretty clear. If you want to use these attribute system you created in C#, maybe you should keep this logic on PC and use arduino just like a dummy. There is a firmware called firmata that does similar things. It only leaves little logic on arduino and most logic on PC to decide what to do. You can make C# send serial message to arduino, say M50+ for motor spin at 50 and in positive direction. Then arduino only processes these and does what it is told. The logic remains on your PC, unless you need this project mobile. If you need the project to be mobile, then I suggest you strip the system down to simple classes and you can still do it on arduino.

I need the project to be mobile...and what do you mean by strip it down to simple classes? ^.-
I've seen the c# serial communication, but I highly doubt I will be going that far.

The system also has a Java variant, because before I learnt c#, I did java so this was created.(Idk if this code below is useful or not. I'm just puttin' it out there.)

private final Map<String, Object> attributes = new HashMap<String, Object>();

	public void setAttribute(String string, Object object) {
		attributes.put(string, object);
	}

	@SuppressWarnings("unchecked")
	public <T> T getAttribute(String string) {
		return (T) attributes.get(string);
	}

	@SuppressWarnings("unchecked")
	public <T> T getAttribute(String string, T fail) {
		T object = (T) attributes.get(string);
		if (object != null) {
			return object;
		}
		return fail;
	}

	public void removeAttribute(String string) {
		attributes.remove(string);
	}