Hi, @johanma44
Welcome to the forum.
Please read the post at the start of any forum , entitled "How to use this Forum".
This will help with advice on how to present your code and problems.
A circuit diagram would be greatly appreciated, please include component names and pin lables along with your power supplies.
Thanks.. Tom..