and mystery

I have played Ardupy for the whole day. Now, I realized that the cannot start itself after boot, which is said in the documentation of MicroPython. I have tried to add, whose content is simply import main, but it does not run after booting as expected. How could I make run after booting, or triggered by a button press?

1 Like

Sorry, Iā€™m late to the party :wink:

Try this:

from machine import LCD

class Myclass:
    def main(self):
        lcd = LCD()                            # Initialize LCD and turn the backlight
        lcd.fillScreen(lcd.color.BLACK)        # Fill the LCD screen with color black
        lcd.setTextSize(2)                     # Setting font size to 2
        lcd.setTextColor(lcd.color.GREEN)      # Setting test color to Green
        lcd.drawString("Another test", 10, 5)   # Printing Hello World at (0, 0)

if __name__ == "__main__":
    myclass = Myclass()

from main import Myclass

myclass = Myclass()