what the "%" is for?

Hi.

I'm sorry if its a stupid question but I would like to learn and not just get work,

on this funtion it returns the average value form altitude.. etc...

But I don't understand what the "% MOVAVG_SIZE;" is used for.

I have tried to search on internet and because the "%" there are no accurate returns..

Could anyone explain me?

Tks a lot.

define MOVAVG_SIZE 32

void PostaMedia(float val) { movavg_buff[movavg_i] = val; movavg_i = (movavg_i + 1) % MOVAVG_SIZE;

//movavg_i = (movavg_i + 1);

}

look in the reference section of this site!

Mark

I didn’t find how it was used in my code…but tks anyway

Did you look? It's only ever used one way.

Look here in the reference section: http://arduino.cc/en/Reference/HomePage#.UwZJmoU4uzY

On the left hand side under arithmetic operators. It's called modulo.

Hell, here's a link to that if getting to it from the reference page is too hard for you.

http://arduino.cc/en/Reference/Modulo#.UwZJ8oU4uzY

Tks. That was a logical mistake not the "%" itself.\

tks s lot