<< return to Pixycam.com

Increase age counter for ccc_hello_world.ino example

I’m running the Pixy2 on an Arduino Uno using the “stock” ccc_hello_world.ino example.

I’ve been working on the Pixy2CCC.h file to try and increase the maximum value for “age” which is held by the uint8_t variable “m_age”. I’ve tried editing the Pixy2CCC.h file and changed the m_age variable to a uint16_t. This definitely does something, but it starts to mess up the logic. I’m sure I need to have another variable increase to a uint16_t as well, but haven’t succeeded in finding the correct combination/method.

Basically, all I’m trying to do is get identical outputs as the original example, just with “age” being able to be/print a 16bit number, not the original 8bit…

FYI - The camera is mounted on the Pixy pan/tilt mechanism, (I’m not using the servos) so I’m just starting with the bone stock ccc_hello_world.ino example and library files.

Any help would be appreciated…

Hello,
Changing the m_age variable to 16-bit won’t help and it will likely hurt things. The age value is being sent over from Pixy as an 8-bit value. Unfortunately, there is no way to change this without changing the firmware.

Are you using an Arduino? It would be easier to keep a larger age count in the Arduino code. That is, you could create a small table with the age count of each object inside the Arduino code.

Edward

Thanks.

I am using an Arduino to run the Pixy2 via the pan/tilt mechanism. I’ve been finding the m_age value and storing it as a global uint8_t that I access from the .ino file. I assumed that the m_age value was calculated in the Pixy2CCC.h file, but I can’t seem to find where it set. Where is it set?

I set up a large age counter function in my .ino file and have an acceptable workaround.

Thanks

Hello,
The age counter is kept inside Pixy :slight_smile:

hi md3530,
I’d be interested in how you tackled this issue, the function you created.
I too would like to extend the age… did you use milis for something like that to get it to work ?? Can you help ?
AK

Hello,
Since the age counter is inside the firmware, it’s difficult to change it’s behavior.
Can you describe what you are trying to do? Perhaps there is another way to accomplish what you are want to do.

https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:ccc_api

Edward

Its a pity the age stops at 255. which gets there very quickly, I’m wanting to track objects on an path that they might be there a bit longer or not. It would be helpful to know, I’m guessing after it hit 255 a Millis timer could start to add 1 to a created 255 variable for the object to represent each further frame the object exists to therefore have a longer age result. It would help determine where in an area the object may be if it was following a path

Hello,
You’re right, since you know the index, you can create your own timing. :slight_smile:

Edward