Modifications

Sauter à la navigation Sauter à la recherche
1 273 octets ajoutés ,  13 mars 2017 à 14:53
Ligne 59 : Ligne 59 :  
Besides the neccesary main.py and boot.py files, you can create any folders and python files or libraries that you want to include in your main file. Pymakr will synchronize all files in the project to the board when using the sync button.
 
Besides the neccesary main.py and boot.py files, you can create any folders and python files or libraries that you want to include in your main file. Pymakr will synchronize all files in the project to the board when using the sync button.
   −
== Ajouter des fichiers ==
+
=== Ajouter des fichiers ===
 
If you create any files (and folder) to your project directory from outside of pymakr, they won’t appear in your project files. To add them, right-click on the left sidebar in the Project-Viewer when you have your project open, and click ‘Add source files’.
 
If you create any files (and folder) to your project directory from outside of pymakr, they won’t appear in your project files. To add them, right-click on the left sidebar in the Project-Viewer when you have your project open, and click ‘Add source files’.
   Ligne 70 : Ligne 70 :  
Adding a folder works in the exact same way, using the ‘Add source directory’ after right-clicking in the project sidebar. All files inside the chosen directories will be added as well.
 
Adding a folder works in the exact same way, using the ‘Add source directory’ after right-clicking in the project sidebar. All files inside the chosen directories will be added as well.
    +
== Sans créer de projet ==
 +
If you just want to test some code on the module without creating a Project, you can create a new file or open an existing one and press the ‘run’ button.
    +
Note that the changes you make to your file won’t be automatically saved to the device on execution.
 +
 +
== Un exemple simple ==
 +
For fun, lets try to build a traffic light. Add the following code to the {{fname|main.py}} file:
 +
 +
<syntaxhighlight lang="python">
 +
import pycom
 +
import time
 +
pycom.heartbeat(False)
 +
for cycles in range(10): # stop after 10 cycles
 +
    pycom.rgbled(0x007f00) # green
 +
    time.sleep(5)
 +
    pycom.rgbled(0x7f7f00) # yellow
 +
    time.sleep(1.5)
 +
    pycom.rgbled(0x7f0000) # red
 +
    time.sleep(4)
 +
</syntaxhighlight>
 +
 +
* Make sure the connection to your board is open in the Pycom Console
 +
* Press the sync button on the top toolbar. Any progress will be shown in the console.
 +
 +
Here is the expected result:
 +
 +
[[Fichier:Hack-pycom-lopy-Pymakr-20.gif]]
 +
 +
You now have a traffic light in your hands. To stop a running program, use ctrl-c or do a right click on the console and press Reset. You can also reboot the board by pressing the physical {{fname|reset}} button.
 +
 +
{{ambox-stop|text=If your board is running code at boot time, you might need to boot it in safe mode.}}
    
[https://docs.pycom.io/pycom_esp32/pycom_esp32/toolsandfeatures.html#pymakr-ide https://docs.pycom.io/pycom_esp32/pycom_esp32/toolsandfeatures.html#pymakr-ide]
 
[https://docs.pycom.io/pycom_esp32/pycom_esp32/toolsandfeatures.html#pymakr-ide https://docs.pycom.io/pycom_esp32/pycom_esp32/toolsandfeatures.html#pymakr-ide]
29 917

modifications

Menu de navigation