python:micropython:gtemps

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
Dernière révisionLes deux révisions suivantes
python:micropython:gtemps [2021/07/08 19:33] – [2.] philpython:micropython:gtemps [2022/08/03 11:47] – [2. Module time] phil
Ligne 1: Ligne 1:
 +[[:python:micropython:accueil|{{ :iconemaison.jpg?nolink&30|Sommaire MicroPython, CircuitPython}}]]
  
 +===== MicroPython - Gestion du temps =====
 +{{ :micropython:logomicropython.png?nolink&120|}}
 +
 +[Mise à jour le : 29/7/2022] <html><span style="color:red">En cours de rédaction</span></html>
 +
 +  * **Ressources**
 +    * <html><a href="https://micropython.org/" target="_blank">MicroPython.org</a></html>
 +    * <html><a href="https://docs.micropython.org/en/latest/index.html#" target="_blank">MicroPython documentation</a></html>
 +    * <html><a href="https://thonny.org/" target="_blank">IDE Thonny</a></html>
 +  * **Lectures connexes**
 +    * <html><a href="https://randomnerdtutorials.com/micropython-esp32-deep-sleep-wake-up-sources/" target="_blank">MicroPython : ESP32 Sources de sommeil profond et de réveil</a></html>
 +    * <html><a href="https://randomnerdtutorials.com/micropython-esp8266-deep-sleep-wake-up-sources/" target="_blank">MicroPython : Sources de veille profonde et de réveil ESP8266</a></html>
 +==== 1. Présentation ====
 +
 +==== 2. Module time ====
 +{{ :python:micropython:materiel:led.jpg?nolink&50|LED}}
 +  * **Ressource** : <html><a href="https://docs.micropython.org/en/latest/index.html" target="_blank">Documentation</a></html> sur docs.micropython.org.
 +
 +  * //Exemple pour un **ESP32 Feather Huzzah** (LED #13)//
 +
 +<code Python helloesp32.py>
 +# Faire clignoter la led de la carte
 +
 +from machine import Pin
 +import time
 +
 +# Led de la carte
 +Led = Pin(13, Pin.OUT)
 +
 +while(True):
 +    Led.on()
 +    time.sleep(1)
 +    Led.off()
 +    time.sleep(1)
 +    
 +</code>
 +
 +  * //Exemples pour un **Raspberry Pi Pico** (LED #25)//
 +
 +<code Python hellopico.py>
 +# Exemple 1
 +# Faire clignoter la led de la carte
 +# A modifier dans le code ci-dessus
 +...
 +Led = Pin(25, Pin.OUT)
 +...
 +</code>
 +
 +{{ :python:micropython:morse.png?nolink&50|}}
 +<code Python morse.py>
 +# Exemple 2
 +# Titre : Message en Morse
 +# Sources
 +#   Elektor n°488,
 +#   https://fr.wikipedia.org/wiki/Code_Morse_international
 +# fichier : morse.py
 +
 +import time
 +from machine import Pin
 +led=Pin(25,Pin.OUT) # Led de la carte
 +BlinkRate=0.25
 +# Code complet téléchargeable à partir du lien ci-dessous
 +</code>
 +
 +{{ :python:micropython:materiel:thonny.png?nolink&70|}}
 +<callout type="tip" icon="true"><html><strong><a href="https://webge.fr/doc/wikis/code/micropython/MICROPYTHON_RPI2_MORSE.zip" target="_blank">Télécharger</a></strong></html> le projet MICROPYTHON_RPI2_MORSE pour Thonny.</callout>
 +
 +==== 3. Module Timer  ====
 +  * //Exemple pour un **Raspberry Pi Pico**//
 +
 +{{ :python:micropython:materiel:led.jpg?nolink&50|LED}}
 +<code python *.py>
 +# Faire clignoter la Led de la carte
 +# Ressource : https://docs.micropython.org/en/latest/rp2/quickref.html
 +
 +from machine import Pin, Timer
 +led = Pin(25, Pin.OUT)
 +timer = Timer()
 +
 +def blink(timer):
 +    led.toggle()
 +
 +timer.init(freq=2.5, mode=Timer.PERIODIC, callback=blink)
 +</code>
 +
 +==== 3.  ====
 +
 +  * **Ressource** : <html><a href="" target="_blank"></a></html> sur Micropython.org.
 +  * **Matériel** : 
 +
 +  * //Exemple//
 +
 +<code python *.py>
 +
 +</code>
 +
 +==== 4.  ====
 +
 +  * **Ressource** : <html><a href="" target="_blank"></a></html> sur Micropython.org.
 +  * **Matériel** : 
 +
 +  * //Exemple//
 +
 +<code python *.py>
 +
 +</code>