Close

ESP8266 vs. ESP32

A project log for Snake on 7-segment displays

Might be very hard to play, but will look awesome!

hari-wigunaHari Wiguna 08/17/2019 at 23:140 Comments

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
def shift_out(self, bits):
for i in range(8):
        value = bits & (1 << i)  # Is bit set or cleared?
        self.data.value(1 if value > 0 else 0)
        self.clock.on()  # pulsing clock HIGH then LOW to shift data
        self.clock.off()

This is faster!

def shift_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 data
        self.clock.off()

Discussions