I bought 50 seven-segment displays for like eight cents each. Asked the Internet what to built and Antonio D'Amore (zombieprocess.it) suggested "Snake". I love it! Thanks Antonio!
I had enable @micropython.native on the ESP8266 to get the best performance in refreshing the displays.
It turned out MicroPython for the ESP32 does not support that option!
Either it is always on, or the ESP32 without that option is FASTER than the ESP8266 with that option.
@micropython.native
defshift_out(self, bits):
for i in range(8):
value = bits & (1 << i) # Is bit set or cleared?self.data.value(1if value > 0else0)
self.clock.on() # pulsing clock HIGH then LOW to shift dataself.clock.off()
This is faster!
defshift_out(self, bits):
for i in range(8):
value = bits & (1 << i) # Is bit set or cleared?if value > 0:
self.data.on()
else:self.data.off()
self.clock.on() # pulsing clock HIGH then LOW to shift dataself.clock.off()
I decided to go with the five rows of eight digits.
So, each row is shifted through eight shift registers and shows up as 64 segments (counting the decimal points).
This is what five rows of 64 bits look like on the scope.
Yellow is the clock, blue is the data, and purple is the latch that is triggered as we switch rows.
Zooming into the first row, lowest bit is high while the other bits are low because on first row we set leftmost digit to 1.
zooming back out, after all 64 bits, you can see the "2" of the next row.
You can see that this time, second bit is high, while the other bits are low.
Subsequent rows are similar and on row 5, you can see the 0xFF as last 8 bits being shifted out.
I wonder how many people read this. Oh well, it was rewarding to see the bits set in a #MicroPython array refreshed by an independent timer so we're free to implement the snake without worrying about updating the display.
Neat project! The mockup looks much better than I had exptects and I'm excited to see the first prototype. The slant of the segments is an interesting design challenge... offsetting the modules should make the overall appearance a bit more interesting.
Will the decimal points be used for the Fruit?