The raspberry pi is not a real-time system, nor would the serial input automatically trigger an interrupt on the raspberry pi and the raspi digital input is unbuffered. Thus if the raspberry pi was too busy with all its multitasking it might miss the input from the bill acceptor and money would be accepted with nothing given in return. The arduino is there to provide buffered input. Right now it's not really doing that properly since it's just relaying immediately to the raspberry pi. What should happen is that it should buffer the input, then tell the raspberry pi and wait for an acknowledgement, buffering all input repeatedly telling the raspberry pi until acknowledgements are received. This also protects against raspberry pi crashes or crashes of the high level software running on it. Crashing the compiled program on the Atmega microcontroller on the other hand is much harder to do.

On Thu, Feb 22, 2018 at 3:25 PM, Thomas Levine <_@thomaslevine.com> wrote:
The vending machine now provides some more feedback after money is put in.

Source code associated with my contribution is here. I haven't documented
the other components of the vending machine.
https://thomaslevine.com/scm/sudo-vending

Based on the implementation details, it appears to me that
the bill acceptor is in fact plugged into one board (Arduino Leonardo)
that is connected by serial to another board (Raspberry Pi). Why is
the former board used at all? That is, why is the bill acceptor not
plugged directly into the latter board?
_______________________________________________
sudo-discuss mailing list
sudo-discuss@lists.sudoroom.org
https://sudoroom.org/lists/listinfo/sudo-discuss