Différences entre versions de « ENG-CANSAT-PICO-MISSION1-AUTONOMOUS »

De MCHobby - Wiki
Sauter à la navigation Sauter à la recherche
Ligne 17 : Ligne 17 :
 
This approach is very efficient but can lead to plateform lock-up when the script is buggy or contains an infinite loop.
 
This approach is very efficient but can lead to plateform lock-up when the script is buggy or contains an infinite loop.
  
{{ambox|text=At MCHobby we do use a slide switch name "RunApp" as recovery method.
+
{{ambox|text=At MCHobby we do use a slide switch name "RunApp" as recovery method.}}
  
 
The aim is to check the status of a given pin (eg: GP22) before starting the user script (say {{fname|user.py}}).
 
The aim is to check the status of a given pin (eg: GP22) before starting the user script (say {{fname|user.py}}).

Version du 21 mars 2022 à 00:34

Inroduction

Page-under-construction.pngPage(s) en cours de traduction/élaboration.

Page(s) under translation/construction

Until now, we have worked with the emitter linked to a computer via USB cable.

Using the USB cable was very useful to capture the debugging message into the REPL Session.

We have two things to do:

  • Start automatically your python script
  • Making the CANSAT working autonomously

Start your Python script

If you want your script to start when powering up your Pico, just copy the script content into a file named main.py .

This approach is very efficient but can lead to plateform lock-up when the script is buggy or contains an infinite loop.

The aim is to check the status of a given pin (eg: GP22) before starting the user script (say user.py).

In case of trouble during testing/development we just switch-off the "RunApp" and press the reset button to restart the Pico.

ENG-CANSAT-PICO-MISSION1-AUTONOMOUS.jpg

Here is the content of main.py script.

from machine import Pin
run = Pin( 22, Pin.IN, Pin.PULL_UP )
if run.value() == 1:
    import user # load user.py file and execute it

Written by Meurisse D. for MCHobby


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.