Modifications

Sauter à la navigation Sauter à la recherche
2 095 octets ajoutés ,  13 mars 2017 à 15:07
Ligne 102 : Ligne 102 :  
{{ambox-stop|text=If your board is running code at boot time, you might need to boot it in safe mode.}}
 
{{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]
+
== Console Pycom ==
 +
To start coding, simply go to the Pycom Console and type your code. Lets try to make the LED light up.
 +
 
 +
<syntaxhighlight lang="python">
 +
import pycom # we need this module to control the LED
 +
pycom.heartbeat(False) # disable the blue blinking
 +
pycom.rgbled(0x00ff00) # make the LED light up in green color
 +
</syntaxhighlight>
 +
 
 +
Change the color by adjusting the hex RGB value
 +
 
 +
<syntaxhighlight lang="python">
 +
pycom.rgbled(0xff0000) # now make the LED light up in red color
 +
</syntaxhighlight>
 +
 
 +
The console can be used to run any python code, also functions or loops. Simply copy-paste it into the console or type it manually. Note that after writing or pasting any indented code like a function or a while loop, you’ll have to press enter up to three times to tell MicroPython that you’re closing the code (this is standard MicroPython behavior).
 +
 
 +
[[Fichier:Hack-pycom-lopy-Pymakr-30.png]]
 +
 
 +
Use {{fname|print()}} to output contents of variables to the console for you to read. Returned values from functions will also be displayed if they are not caught in a variable. This will not happen for code running from the main or boot files. Here you need to use print() to output to the console.
 +
 
 +
A few pycom-console features you can use:
 +
 
 +
* '''Input history''': use arrow up and arrow down to scroll through the history
 +
* '''Tab completion''': press tab to auto-complete variables or module names
 +
* '''Stop any running code''': with ctrl-c
 +
* '''Copy/paste code or output''': ctrl-c and ctrl-v (cmd-c and cmd-v for mac)
 +
 
 +
== Connectez pymakr sur vos cartes ==
 +
# Connect your computer to the WiFi network named after your board (e.g. {{fname|lopy-wlan-xxxx}}, {{fname|wipy-wlan-xxxx}} ). The password is {{fname|www.pycom.io}}
 +
# Open Pymakr.
 +
# In the menu, go to "Settings > Preferences" ("Pymakr > Preferences" on macOS).
 +
# In the left list look for Pycom Device.
 +
# For device, type down {{fname|192.168.4.1}} . The default username and password are {{fname|micro}} and {{fname|python}}, respectively.
 +
# Click OK
 +
 
 +
{{ambox|text=Pymakr also supports wired connections. Instead of typing the IP address, you can click on the combo box arrow and select the proper serial port from the list. Our boards don’t require any username or password for the serial connection, so you can leave those fields empty.}}
 +
 
 +
 
   −
Placer ici la section pymakr-ide de la page "toolsandfeatures"
      
{{LOPY-TRAILER}}
 
{{LOPY-TRAILER}}
29 917

modifications

Menu de navigation