Jun-29-2025, 10:49 AM
Hi guys.
Just started out with python, programming a small ESP343, where I would like to create a python script for running.
But I'm no shark in programming - so be gentle
I've bought some time ago - Lego Millinium Falcon - and would like to spice this a little op.
I want to create my own python script - for lightning up the Falcon in the dark.
So here I just wondering the difference between:
But my Thonny - does not give any error and just for this I do not know why ? So I hoping on One of You to help me a little bit here
My high hopes is - creating this Python script to run a script, where my definitions will be given a number - so try loop will choose a different next time.
For my point of view - and hopefully learn something about python - I'm hoping this little project - creating a script for the ESP343 - making the Falcon fly in the bedroom.
Just started out with python, programming a small ESP343, where I would like to create a python script for running.
But I'm no shark in programming - so be gentle
I've bought some time ago - Lego Millinium Falcon - and would like to spice this a little op.
I want to create my own python script - for lightning up the Falcon in the dark.
So here I just wondering the difference between:
from machine import Pin from time import sleep_ms led1=Pin(1,Pin.OUT) led2=Pin(2,Pin.OUT) try: while True: led1.value(1) led2.value(1) sleep_ms(6000) led1.value(0) led2.value(0) sleep_ms(6000) except: passAnd the same code in my head are not working
from machine import Pin from time import sleep_ms led1=Pin(1,Pin.OUT) led2=Pin(2,Pin.OUT) def cockpit(): led1.value(1) led2.value(1) sleep_ms(6000) led1.value(0) led2.value(0) sleep_ms(6000) try: while True: cockpitt() except: passI'm not getting any error when trying the last - but was hoping creating the light as individuel light for cockpitt, the backend - where i need som small LED strips for - but as all - I need to learn to crawl before I can walk.
But my Thonny - does not give any error and just for this I do not know why ? So I hoping on One of You to help me a little bit here
My high hopes is - creating this Python script to run a script, where my definitions will be given a number - so try loop will choose a different next time.
For my point of view - and hopefully learn something about python - I'm hoping this little project - creating a script for the ESP343 - making the Falcon fly in the bedroom.