or can someone help me with these code?
I thought I was helping you?
Or by helping do you mean doing it for you?
is there a example?
No idea, but this sort of thing is a bit rare so I wold not expect one, especially as it is so trivial.
You seem to be having difficulty understanding how things work here, read this How to use this forum - please read - #2 by nickgammon - Website and Forum - Arduino Forum