decoder issue

I have a problem to solve tiil nexr sunday.

We are planing to use the decoder sensor.
when I run a program with it {with a working motor ofcourse} the output is running numbers.
Each whole loop of the Small 21 tooth Sprocket is a value of 136321 or close.

What does those numbers?
can anyone give as an exmaple some numbers he go?

tnx!

Hmmm, this question is a little hard to decode :slight_smile: By “decoder” are you talking about the gear tooth sensor? Since you are posting in the EasyC section I am assuming you are using the EasyC GearToothTest example. Output from the GetGTSensor is a ‘long’, but the print output is wrong because of overflow (this from another post).

On another note, I assume you are waiting for the fix-it windows to work on this right?

ammmm yeah I forgot to mention that its the gear tooth sensor

but still I didnt understand what are does running numbers ?

Its important till tomorrow so…

Well, again I am assuming your are using the test program, try casting it as a long so that it looks like this:

PrintToScreen ( "Gear tooth count = %ld
" , (long)geartooth ) ;

That should fix the output so that it makes since to you. I believe you are just having overflow because a long can’t be stuffed into an int.

Yeah I done that and it works.
Buy mu question from the begining was what are those numbers at all??

Generally, whenever you overflow a variable, it is hard to predict what will happen. In some cases it wraps around, in other cases it flows into unassigned memory addresses. The main thing is that when you get strange output, one of the things to look at is to make sure your variable is cast correctly (which you did).

And how to be sure I did it right?
would you give an example please?

well all I can say is that if it is counting right, then you have done it right!

You mean counting right or counting at all?

Based on the output it looks like you were using %d to print a long instead of %ld.

Nope, sir!

I was using the %ld as it should be.