I am trying to set up an Arduino Nano ESP32 so that I can code in MicroPython. I successfully installed Arduino Lab for MicroPython and flashed the firmware onto the device, but when I try to run the sample code from the MicroPython Installation Guide, it fails, citing a syntax error. Curiously, it works fine when I run it through the REPL.
After spending a while trying to debug, I found something interesting. The following code yields the error "Traceback (most recent call last): File "<stdin>", line 11 SyntaxError: invalid syntax"
import time
while True:
print("1")
time.sleep(1)
print("2")
time.sleep(1)
print("3")
time.sleep(1)
print("4")
time.sleep(1)
However, if I get rid of the last two lines, it works fine. And once again, the full code works fine if I copy-paste into the REPL. What could be going wrong?
Edit: After spending some more time debugging, it looks like the failure is based on the number of characters in the script. Anything more than 128 characters causes it to fail.