raspberrypi-examples
raspberrypi-examples copied to clipboard
gets stuck in writeByte's ACK loop
After running the digital clock for a few days, it gets stuck in the loop here:
while(IO.input(self.__Datapin)):
sleep(0.001)
if(IO.input(self.__Datapin)):
IO.setup(self.__Datapin, IO.OUT)
IO.output(self.__Datapin, IO.LOW)
IO.setup(self.__Datapin, IO.IN)
I can "fix" it by removing and replugging the Data In connector. I note that clones of this library have removed this ACK loop, i.e., here.
My questions:
- is this loop necessary at all?
- should the number of tries be limited?
- is it safe to continue (or should an exception be thrown) if the ACK doesn't arrive?