Adding function to a value

@mg073, the laconic answers from @kolaha are a hint that more information is needed.

  • post the current code (with code tags please)
  • post the electric schema of the circuit and details about power, type of arduino etc...

otherwise you are asking us to guess a lot and the proverbial crystal ball is still in the dishwasher...

➜ read How to get the best out of this forum.