I try to insert my python code inside the main.c of the firmware but i dont find the main.py.
I mean main.py always wait an usb connexion in place of my uart com and led blinking.
First, I tried to modify the array (fresh_main_py) used to create file on the sdcard, but i dont use sdcard, so it is never used...
Code: Select all
static const char fresh_main_py = "#main.py -- put your code here!\n" "import pyb, time\n" "led=pyb.LED(2)\n" "uart=pyb.UART(3,19200)\n" "while(True):\n" " uart.write(b'A')\n" " led.on()\n" " time.sleep(150)\n" " led.off()\n" ;
Secondly, i tried to use exec_boot_script("path/script.py", false, true) but it does nothing because the path is wrong like boot, selftest but opposite to main.py ?
I suppose it is used for sd card file but how it works with main.py without sdcard...
Thirdly, I dont find any main.py in src directory ?
I am lost, what is your point to do this simply ?
pyexec_str function uses a vstr_t than i dont know...