I have code which uses a proximity switch, screen, rotary encoder and a LED which work perfectly when wired into the arduino. I am trying to condense the circuit and want to remove the arduino and run from the ATMEGA328 chip. It uploads and run everything fine apart from my switch long press. Short press functions correctly. I have swapped the proximity switch out for a push button and it still doesn’t function properly.
I have got the 16MHz crystal and 22pf capacitors as in the arduino tutorial here
From my understanding is that if it works on the arduino, however it only ever detects a short press and not a long.
A short press should activate the pump for 1 time period and a long press activates it for another time period.
(An arduino nano isn’t really possible due to time and height restrictions.)
Attached is my code as its too long
Any help would be appreciated