kloon / OpenBeerFiller

An opensource beer filling line microcontroller
GNU General Public License v3.0
39 stars 13 forks source link

Use interrupts for beer sensing #3

Closed kloon closed 4 years ago

kloon commented 4 years ago

The current code utilises a while loop for sensing when a bottle/can has reached its full capacity, the problem with this is that it causes a block in the main program loop which is not ideal.

Using interrupts we can eliminate this while loop block in the main loop allowing for other critical functionality that relies on the main loop to execute flawlessly.

The problem we need to solve is that there's only two interrupt pins on the Uno and we require a lot more to monitor the three filling solenoids as well as a kill switch.

The solution would be to look at ways we can utilise a single pin and attach multiple interrupts and inputs on that pin.

This issue is only present with the Arduino Uno, the ESP8266 supports interrupts on all its digital pins.