Updated IO and digital pin to use events.