Hack-pycom-lopy-Pymakr

De MCHobby - Wiki
Sauter à la navigation Sauter à la recherche


MCHobby investit du temps et de l'argent dans la réalisation de traduction et/ou documentation. C'est un travail long et fastidieux réalisé dans l'esprit Open-Source... donc gratuit et librement accessible.
SI vous aimez nos traductions et documentations ALORS aidez nous à en produire plus en achetant vos produits chez MCHobby.

Pymakr - présentation

Pymarkr est un Environnement de développement (IDE) pour LoPy, WiPys et autres plateformes. Cet environnement est disponible sous Windows, Linux Debian, Linux Red Hat et MAC OS X.

Si vous n'avez pas encore eu l'occasion de faire du hacking électronique avec les cartes Pycom, vous devriez télécharger la dernière version de l'IDE pour découvrir les fonctionnalités offertes par Pymark.

Hack-pycom-lopy-Pymakr-00.png
Cliquer pour agrandir

Parmi les fonctionnalités, vous retrouverez:

  1. Synchronisation de projets.
  2. Téléversement automatique du code sur votre carte.
  3. Détection des nouveaux Firmware & mise-à-jour de la carte.
  4. Clique pour exécution (Run) d'un fichier.

Pymark c'est...

Un environnement de développement complet qui se connecte automatiquement sur vos cartes Pycom via Telnet (ou le port série), exécute du code à la volée, gère le système de fichier interne, synchronise votre code instantanément et l'exécute à l'aide d'un simple clique.

Il prend soin de vérifier que le firmware de la carte Pycom soit bien à jour et propose une console qui s'interface avec le mode REPL de MicroPython.

Pymakr est également une plateforme développée pour supporter les développements avec LoPy (Carte pour réseau Lora).

N'hésitez à rejoindre les Forums Pycom pour en apprendre plus sur le Pymakr et le plateformes PyCom.

Ressources

Liens de téléchargement:

Vous pouvez également trouver le code source sur Github:

Pymakr dispose d'une système de greffons (plugin) et dispose déjà d'un premier greffons pour Pymaker.

Créer un projet

Pymakr has a feature to sync and run your code on your device. This is mostly done using projects. The following steps will get you started.

  • In Pymakr, go to Project > New project.
  • Give it a name and select a folder for your project, either a new of existing one.
  • Create two files: main.py and boot.py, if you don’t already have those.

The boot.py file should always have the following code on the top, so we can run our python scripts over serial or telnet:

from machine import UART
import os
uart = UART(0, 115200)
os.dupterm(uart)

Most users, especially WiPy users, would want a wifi script in the boot.py file. A basic wifi script but also more advanced WLAN examples, like fixed IP and multiple networks, can be found in the Wifi Examples chapter.

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

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’.

Hack-pycom-lopy-Pymakr-10.png

In the popup that appears, click the folder icon next to the ‘Source files’ input and select one or more files to be included.

Hack-pycom-lopy-Pymakr-11.png

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 main.py file:

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)
  • 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:

Hack-pycom-esp 32-60.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 reset button.

https://docs.pycom.io/pycom_esp32/pycom_esp32/toolsandfeatures.html#pymakr-ide

Placer ici la section pymakr-ide de la page "toolsandfeatures"


Tutoriel PyCom Getting started (ESP_32) sous copyright de Damien George et contributeurs en ce qui concerne MicroPython et/ou PyCom en ce qui concerne les informations relatives a WiPy et LoPy.

Tutoriel traduit par Meurisse D. pour MCHobby.be

Traduit avec l'autorisation de micropython.org - Translated with the authorisation of micropython.org

Toute référence, mention ou extrait de cette traduction doit être explicitement accompagné du texte suivant : «  Traduction par MCHobby (www.MCHobby.be) - Vente de kit et composants » avec un lien vers la source (donc cette page) et ce quelque soit le média utilisé.

L'utilisation commercial de la traduction (texte) et/ou réalisation, même partielle, pourrait être soumis à redevance. Dans tous les cas de figures, vous devez également obtenir l'accord du(des) détenteur initial des droits. Celui de MC Hobby s'arrêtant au travail de traduction proprement dit.