Hello!
I don't know if this is the right place to ask this question, but no specific Alvik category exists, so here I am.
There is something I don't understand in Alvik's usage.
(1) I turn Alvik off, I connect it to pc, I run Arduino Lab for Micropython, I establish a software connection (connection button in the Arduino Lab IDE), I type some source code into the IDE and send it to the robot, I finally turn the robot on (it is still connected both physically and electronically).
(2) My program starts running after a while (e.g. the robot runs); I physically disconnect the robot, my program continues working in the robot (e.g. Alvik continues running)
(3) Now, I turn the (disconnected) robot off, then I turn it on again: my program does not start! on the contrary, the default "three ready-to-go examples" starts: my program remains "invisible"
(4) I now turn the robot off, I connect it again to computer, I turn the robot on: nothing changes ("three ready-to-go examples" starts: again, my program is not visible)
(5) I now establish software connection (again the connection button), I reupload my program, now it works again!
It is evident there is something I don't understand: it would be normal for me to upload once and run several times without reconnecting to pc.
The problem is systematic: I have two robots (the firmware was updated yesterday on one of them), and both do the same, so it must be something I am doing wrong.
After sending the code:
I turn it on (it is not clear to me if I have to turn it on before sending the code, or after doing it, but I tried both) and the robot starts running (executing my dumb code), then...
I detach the cable: everything looks fine, the robot continues running. Now...
I turn the robot off, then...
I turn it on again: the robot has forgotten everything and the "three option demo code" starts. I have to reconnect and resend my code.
I have understood what happens. The mBlock app replaces the main.py file on the robot by its own program. To restore the original demo, you have to edit the main.py file and replace the code by "import demo".
To edit main.py, use the app "Arduino lab for MicroPython".
Hello, thanks for your contribution. My problem seems a bit different, because the original demo is the only thing that works after removing the connection between the robot and the pc. In my case it looks like there are two different ways of "booting", one when connected, one when detached, and it seems that transferring new code to the robot does not remove the old one (the demo).
Moreover, I am only using Arduino Lab for MicroPython.
I don't know yet how MicroPython works on Alvik, so I cannot figure out what is going on.
I am quite sure that if I start using C++ and the Arduino IDE, everything will work as normal, because in that case I will be actually wiping the MicroPython environment out and clean things, but I wish to use python.
Anyway, thanks.
I will play with the robots during Christmas vacations and be back if I find anything.
At present I am quite discouraged...
Best regards, and merry Christmas / happy Winter vacations.
Giorgio
Dear Arduinob8on, thanks for your kind reply! Your answer explains very well what is going on! As I thought, it was something I didn't know about how Alvik works. Moreover, I did not find this information in the Web DOC pages, probably my fault.
By the "file manager" button I could load main.py, I changed it with my code, and now everything is ok!
Really, really thanks!
Best regards,
Giorgio