{"id":3153,"date":"2025-07-28T10:08:45","date_gmt":"2025-07-28T09:08:45","guid":{"rendered":"https:\/\/workboot.fr\/ciela\/?page_id=3153"},"modified":"2025-12-03T10:41:20","modified_gmt":"2025-12-03T09:41:20","slug":"rpi_2-python-avec-rpi","status":"publish","type":"page","link":"https:\/\/workboot.fr\/ciela\/rpi_2-python-avec-rpi\/","title":{"rendered":"RPI_2 Python"},"content":{"rendered":"<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><a href=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/Raspberry.jpeg\"><img loading=\"lazy\" decoding=\"async\" width=\"200\" height=\"200\" src=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/Raspberry.jpeg\" alt=\"\" class=\"wp-image-4920\" style=\"width:84px;height:auto\" srcset=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/Raspberry.jpeg 200w, https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/Raspberry-150x150.jpeg 150w\" sizes=\"auto, (max-width: 200px) 100vw, 200px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">\ud83d\udd52 : 3 h maximum<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignright size-full is-resized\"><a href=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/python2.webp\"><img loading=\"lazy\" decoding=\"async\" width=\"408\" height=\"408\" src=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/python2.webp\" alt=\"\" class=\"wp-image-4927\" style=\"width:212px;height:auto\" srcset=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/python2.webp 408w, https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/python2-300x300.webp 300w, https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/python2-150x150.webp 150w\" sizes=\"auto, (max-width: 408px) 100vw, 408px\" \/><\/a><\/figure>\n<\/div>\n\n\n<nav aria-label=\"Table des mati\u00e8res\" class=\"wp-block-table-of-contents\"><ol><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_2-python-avec-rpi\/#prerequis\">Pr\u00e9requis:<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_2-python-avec-rpi\/#but\"> But:<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_2-python-avec-rpi\/#repertoire-du-travail\">R\u00e9pertoire du travail:<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_2-python-avec-rpi\/#installation\">Installation<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_2-python-avec-rpi\/#interpreteur-en-ligne-python3\">Interpr\u00e9teur en ligne , python3<\/a><ol><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_2-python-avec-rpi\/#concepts-poo-illustres\">Concepts POO illustr\u00e9s :<\/a><\/li><\/ol><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_2-python-avec-rpi\/#passons-au-code-blink-py\">Passons au code blink.py<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_2-python-avec-rpi\/#saisir-ce-code-et-le-tester\">Saisir ce code et le tester<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_2-python-avec-rpi\/#avec-le-debugger-pdb\">Avec le Debugger pdb <\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_2-python-avec-rpi\/#tester-ce-code-avec-pdb\">Tester ce code avec pdb<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_2-python-avec-rpi\/#donner-l-organigramme-et-le-pl-avec-monia\">Donner l&rsquo;organigramme et le PL avec Monia<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_2-python-avec-rpi\/#code-ilsled-py\">Code ilsled.py<\/a><ol><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_2-python-avec-rpi\/#saisir-ce-code-et-tester\">Saisir ce code et tester<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_2-python-avec-rpi\/#donner-les-organigrammes-et-pl-avec-monia\">Donner les organigrammes et Pl avec Monia<\/a><\/li><\/ol><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_2-python-avec-rpi\/#conclusion-du-tp\">Conclusion du TP<\/a><\/li><\/ol><\/nav>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"prerequis\">Pr\u00e9requis:<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>TP <a href=\"https:\/\/workboot.fr\/ciela\/rpi_0-installation\/\">RPI_0 <\/a>et <a href=\"https:\/\/workboot.fr\/ciela\/rpi1\/\">RPI_1<\/a> effectu\u00e9s , machine R<\/li>\n\n\n\n<li>cours sur <a href=\"https:\/\/workboot.fr\/ciela\/python3\/\">python3 <\/a>et cours<a href=\"https:\/\/workboot.fr\/ciela\/langage-c\/\"> langage C<\/a> de l&rsquo; ann\u00e9e 1<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"but\"> But:<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Mettre en oeuvre du d\u00e9veloppement logiciel avec Python et langage C (gcc)<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"repertoire-du-travail\">R\u00e9pertoire du travail:<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">~\/Works\/RPI_2<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"installation\">Installation<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">installer la lib pour utiliser libgpiod dans python<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update\nsudo apt install python3-libgpiod  # Installe le binding Python pour libgpiod<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"interpreteur-en-ligne-python3\">Interpr\u00e9teur en ligne , python3<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">on va reprendre le montage du tp pr\u00e9c\u00e9dent.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/07\/Gpio17_LED.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"750\" src=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/07\/Gpio17_LED-1024x750.png\" alt=\"\" class=\"wp-image-2964\" srcset=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/07\/Gpio17_LED-1024x750.png 1024w, https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/07\/Gpio17_LED-300x220.png 300w, https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/07\/Gpio17_LED-768x563.png 768w, https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/07\/Gpio17_LED.png 1280w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">bruno@rpi364:~\/Works\/RPI_2 $ python\nPython 3.9.2 (default, Mar 20 2025, 02:07:39) \n[GCC 10.2.1 20210110] on linux\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> <\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">en ligne de commande on va piloter la led GPIO17<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">>>> import gpiod                   #charger la librarie gpiod\n>>> chip = gpiod.Chip('gpiochip0') # Cr\u00e9e un objet chip \u00e0 partir de la classe gpiod.Chip.\n>>> led = chip.get_line(17)\n>>> led.request(consumer=\"LED\", type=gpiod.LINE_REQ_DIR_OUT)\n>>> led.set_value(1)  # ON\n>>> led.set_value(0)  # OFF\n>>> led.release()  # Lib\u00e9ration propre<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">On v a ici s&rsquo;initier la POO , programmation orient\u00e9e objet<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># Importation de la classe gpiod depuis le module gpiod\n# En POO: On importe la 'bo\u00eete \u00e0 outils' principale contenant les classes n\u00e9cessaires\n>>> import gpiod\n\n# Instanciation de l'objet 'chip' \u00e0 partir de la classe Chip\n# En POO: gpiod.Chip est le constructeur qui cr\u00e9e un objet repr\u00e9sentant le contr\u00f4leur mat\u00e9riel\n# 'gpiochip0' est le nom du device mat\u00e9riel (v\u00e9rifiable avec gpiodetect)\n>>> chip = gpiod.Chip('gpiochip0')\n\n# Cr\u00e9ation d'un objet 'led' \u00e0 partir de la m\u00e9thode get_line() de l'objet chip\n# En POO: get_line() est une m\u00e9thode d'instance qui retourne un objet Line\n# 17 correspond \u00e0 l'offset (GPIO17 en num\u00e9rotation BCM)\n>>> led = chip.get_line(17)\n\n# Configuration de l'objet led via la m\u00e9thode request()\n# En POO:\n# - consumer=\"LED\" : Nom arbitraire pour identifier l'usage (principe d'encapsulation)\n# - type=... : Sp\u00e9cifie le comportement de l'objet (ici sortie)\n# Cela illustre le principe d'abstraction: on configure sans savoir comment c'est impl\u00e9ment\u00e9\n>>> led.request(consumer=\"LED\", type=gpiod.LINE_REQ_DIR_OUT)\n\n# Utilisation de la m\u00e9thode set_value() de l'objet led\n# En POO: \n# - set_value() est une m\u00e9thode qui modifie l'\u00e9tat interne de l'objet\n# - 1\/0 repr\u00e9sente l'\u00e9tat HIGH\/LOW (interface simplifi\u00e9e vers le mat\u00e9riel)\n>>> led.set_value(1)  # ON - Active la sortie (m\u00e9thode publique d'interface)\n\n>>> led.set_value(0)  # OFF - D\u00e9sactive la sortie\n\n# Appel de la m\u00e9thode release() pour lib\u00e9rer les ressources\n# En POO:\n# - Gestion propre des ressources (destruction explicite)\n# - Bonne pratique pour \u00e9viter les fuites m\u00e9moire et les conflits mat\u00e9riels\n# - Analogie avec le destructeur (mais appel\u00e9 manuellement ici)\n>>> led.release()  # Lib\u00e9ration propre de l'objet led<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"concepts-poo-illustres\">Concepts POO illustr\u00e9s :<\/h3>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li><strong>Encapsulation<\/strong>&nbsp;:\n<ul class=\"wp-block-list\">\n<li>Les d\u00e9tails mat\u00e9riels sont cach\u00e9s dans les objets&nbsp;<code>Chip<\/code>&nbsp;et&nbsp;<code>Line<\/code><\/li>\n\n\n\n<li>On interagit via des m\u00e9thodes simples (<code>set_value()<\/code>) sans voir la complexit\u00e9 sous-jacente<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Abstraction<\/strong>&nbsp;:\n<ul class=\"wp-block-list\">\n<li><code>gpiod.Chip<\/code>&nbsp;abstrait le contr\u00f4leur mat\u00e9riel<\/li>\n\n\n\n<li><code>LINE_REQ_DIR_OUT<\/code>&nbsp;est une constante qui masque les d\u00e9tails bas niveau<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Messaging<\/strong>&nbsp;:\n<ul class=\"wp-block-list\">\n<li><code>led.set_value(1)<\/code>&nbsp;envoie un \u00ab\u00a0message\u00a0\u00bb \u00e0 l&rsquo;objet pour changer d&rsquo;\u00e9tat<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Gestion du cycle de vie<\/strong>&nbsp;:\n<ul class=\"wp-block-list\">\n<li>Construction :&nbsp;<code>gpiod.Chip()<\/code><\/li>\n\n\n\n<li>Utilisation : m\u00e9thodes&nbsp;<code>request()<\/code>,&nbsp;<code>set_value()<\/code><\/li>\n\n\n\n<li>Destruction :&nbsp;<code>release()<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Vous allez revoir les concepts de la POO en \u00e9tudiant le C++<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"passons-au-code-blink-py\">Passons au code blink.py<\/h2>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#!\/bin\/python3i\nmport gpiod\nimport time\n\n# Configuration\nLED_CHIP = 'gpiochip0'  # Nom du contr\u00f4leur GPIO\nLED_PIN = 17            # Num\u00e9ro GPIO (BCM)\nINTERVAL = 1.0          # 1 seconde allum\u00e9, 1 seconde \u00e9teint (0.5 Hz)\n\n# Initialisation\nchip = gpiod.Chip(LED_CHIP)          # Ouvre le contr\u00f4leur GPIO\nled = chip.get_line(LED_PIN)         # R\u00e9cup\u00e8re la ligne GPIO\nled.request(consumer=\"blink\", type=gpiod.LINE_REQ_DIR_OUT)  # Configure en sortie\n\n# Clignotement\ntry:\n    while True:\n        led.set_value(1)             # Allume la LED\n        time.sleep(INTERVAL)         # Attend 1 seconde\n        led.set_value(0)             # \u00c9teint la LED\n        time.sleep(INTERVAL)         # Attend 1 seconde\n        \nexcept KeyboardInterrupt:\n    pass\n\n# Nettoyage\nled.set_value(0)                     # \u00c9teint la LED\nled.release()                       # Lib\u00e8re la GPIO\nchip.close()                        # Ferme le contr\u00f4leur\nprint(\"Programme arr\u00eat\u00e9, LED \u00e9teinte\")<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"saisir-ce-code-et-le-tester\">Saisir ce code et le tester<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">r\u00e9pertoire: blink , code : blink.py<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"avec-le-debugger-pdb\">Avec le Debugger pdb <\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>bruno@rpi364:~\/Works\/RPI_2\/blink $ python3 -m pdb blink.py\n&gt; \/home\/bruno\/Works\/RPI_2\/blink\/blink.py(2)&lt;module&gt;()\n-&gt; import gpiod\n(Pdb) n\n&gt; \/home\/bruno\/Works\/RPI_2\/blink\/blink.py(3)&lt;module&gt;()\n-&gt; import time\n(Pdb) n\n&gt; \/home\/bruno\/Works\/RPI_2\/blink\/blink.py(6)&lt;module&gt;()\n-&gt; LED_CHIP = 'gpiochip0'  # Nom du contr\u00f4leur GPIO\n(Pdb) n\n&gt; \/home\/bruno\/Works\/RPI_2\/blink\/blink.py(7)&lt;module&gt;()\n-&gt; LED_PIN = 17            # Num\u00e9ro GPIO (BCM)\n(Pdb) p LED_CHIP\n'gpiochip0'\n(Pdb) \n<\/code><\/pre>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li><strong>Commandes essentielles<\/strong>&nbsp;:\n<ul class=\"wp-block-list\">\n<li><code>n<\/code>&nbsp;(next) : Ex\u00e9cute la ligne suivante<\/li>\n\n\n\n<li><code>c<\/code>&nbsp;(continue) : Continue jusqu&rsquo;au prochain point d&rsquo;arr\u00eat<\/li>\n\n\n\n<li><code>p &lt;variable&gt;<\/code>&nbsp;: Affiche la valeur (ex:&nbsp;<code>p LED_PIN<\/code>)<\/li>\n\n\n\n<li><code>l<\/code>&nbsp;(list) : Montre le code autour de la ligne actuelle<\/li>\n\n\n\n<li><code>q<\/code>&nbsp;(quit) : Quitte le d\u00e9bogueur<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"tester-ce-code-avec-pdb\">Tester ce code avec pdb<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">vous pouvez vous aider du<a href=\"https:\/\/workboot.fr\/ciela\/python3\/\"> cours python<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"donner-l-organigramme-et-le-pl-avec-monia\">Donner l&rsquo;organigramme et le PL avec Monia<\/h2>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"avec-l-ils-on-va-reprendre-le-2-eme-schema-deja-vu\">Avec l&rsquo;ILS on va reprendre le 2 \u00e8me sch\u00e9ma (d\u00e9j\u00e0 vu)<\/h1>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/07\/reed_led.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"738\" src=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/07\/reed_led-1024x738.png\" alt=\"\" class=\"wp-image-3041\" srcset=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/07\/reed_led-1024x738.png 1024w, https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/07\/reed_led-300x216.png 300w, https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/07\/reed_led-768x553.png 768w, https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/07\/reed_led.png 1280w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"code-ilsled-py\">Code ilsled.py<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">R\u00e9pertoire : ilsled , code : ilsled.py<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#!\/usr\/bin\/env python3\n# Script de copie GPIO27 \u2192 GPIO17 - Version p\u00e9dagogique\n\n# Importation des biblioth\u00e8ques\nimport gpiod  # Pour contr\u00f4ler les GPIO\nimport time   # Pour les petites pauses\n\n# === Configuration ===\nBROCHE_ENTREE = 27   # GPIO27 en entr\u00e9e (capteur\/bouton)\nBROCHE_SORTIE = 17    # GPIO17 en sortie (LED\/relais)\nNOM_CHIP = 'gpiochip0' # Nom du contr\u00f4leur GPIO (toujours gpiochip0 sur RPi)\n\n# === Initialisation GPIO ===\n# 1. On ouvre le contr\u00f4leur GPIO\nchip = gpiod.Chip(NOM_CHIP)\n\n# 2. On configure les broches :\n#    - GPIO27 en entr\u00e9e (pour lire un bouton\/capteur)\n#    - GPIO17 en sortie (pour piloter une LED\/relais)\nentree = chip.get_line(BROCHE_ENTREE)\nsortie = chip.get_line(BROCHE_SORTIE)\n\nentree.request(consumer=\"entree\", type=gpiod.LINE_REQ_DIR_IN)\nsortie.request(consumer=\"sortie\", type=gpiod.LINE_REQ_DIR_OUT)\n\n# === Boucle principale ===\ntry:\n    print(\"D\u00e9marrage de la copie GPIO27 \u2192 GPIO17 (CTRL+C pour arr\u00eater)\")\n    \n    while True:\n        # 1. Lire l'\u00e9tat actuel de GPIO27 (0 ou 1)\n        etat_entree = entree.get_value()\n        \n        # 2. Copier cette valeur sur GPIO17\n        sortie.set_value(etat_entree)\n        \n        # 3. Petite pause pour \u00e9viter de surcharger le CPU\n        time.sleep(0.05)  # 50ms\n\nexcept KeyboardInterrupt:\n    # === Nettoyage ===\n    print(\"\\nArr\u00eat propre du programme...\")\n    entree.release()\n    sortie.release()\n    chip.close()\n    print(\"GPIO lib\u00e9r\u00e9es, script termin\u00e9.\")<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"saisir-ce-code-et-tester\">Saisir ce code et tester<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">R\u00e9pertoire: ilsled , code: ilsled.py<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"donner-les-organigrammes-et-pl-avec-monia\">Donner les organigrammes et Pl avec Monia<\/h3>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"conclusion-du-tp\">Conclusion du TP<\/h2>\n","protected":false},"excerpt":{"rendered":"<p>\ud83d\udd52 : 3 h maximum Pr\u00e9requis: But: R\u00e9pertoire du travail: ~\/Works\/RPI_2 Installation installer la lib pour utiliser libgpiod dans python Interpr\u00e9teur en ligne , python3 on va reprendre le montage [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","_uag_custom_page_level_css":"","footnotes":""},"class_list":["post-3153","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>RPI_2 Python - workboot<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/workboot.fr\/ciela\/rpi_2-python-avec-rpi\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"RPI_2 Python - workboot\" \/>\n<meta property=\"og:description\" content=\"\ud83d\udd52 : 3 h maximum Pr\u00e9requis: But: R\u00e9pertoire du travail: ~\/Works\/RPI_2 Installation installer la lib pour utiliser libgpiod dans python Interpr\u00e9teur en ligne , python3 on va reprendre le montage [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/workboot.fr\/ciela\/rpi_2-python-avec-rpi\/\" \/>\n<meta property=\"og:site_name\" content=\"workboot\" \/>\n<meta property=\"article:modified_time\" content=\"2025-12-03T09:41:20+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/Raspberry.jpeg\" \/>\n\t<meta property=\"og:image:width\" content=\"200\" \/>\n\t<meta property=\"og:image:height\" content=\"200\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:label1\" content=\"Dur\u00e9e de lecture estim\u00e9e\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/rpi_2-python-avec-rpi\\\/\",\"url\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/rpi_2-python-avec-rpi\\\/\",\"name\":\"RPI_2 Python - workboot\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/rpi_2-python-avec-rpi\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/rpi_2-python-avec-rpi\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/wp-content\\\/uploads\\\/2025\\\/11\\\/Raspberry.jpeg\",\"datePublished\":\"2025-07-28T09:08:45+00:00\",\"dateModified\":\"2025-12-03T09:41:20+00:00\",\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/workboot.fr\\\/ciela\\\/rpi_2-python-avec-rpi\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/rpi_2-python-avec-rpi\\\/#primaryimage\",\"url\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/wp-content\\\/uploads\\\/2025\\\/11\\\/Raspberry.jpeg\",\"contentUrl\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/wp-content\\\/uploads\\\/2025\\\/11\\\/Raspberry.jpeg\",\"width\":200,\"height\":200},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/#website\",\"url\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/\",\"name\":\"workboot\",\"description\":\"Open Source, Open Minds \",\"publisher\":{\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"fr-FR\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/#organization\",\"name\":\"workboot\",\"url\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/wp-content\\\/uploads\\\/2025\\\/05\\\/logo_ciel-dorian-1.png\",\"contentUrl\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/wp-content\\\/uploads\\\/2025\\\/05\\\/logo_ciel-dorian-1.png\",\"width\":1024,\"height\":950,\"caption\":\"workboot\"},\"image\":{\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/#\\\/schema\\\/logo\\\/image\\\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"RPI_2 Python - workboot","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/workboot.fr\/ciela\/rpi_2-python-avec-rpi\/","og_locale":"fr_FR","og_type":"article","og_title":"RPI_2 Python - workboot","og_description":"\ud83d\udd52 : 3 h maximum Pr\u00e9requis: But: R\u00e9pertoire du travail: ~\/Works\/RPI_2 Installation installer la lib pour utiliser libgpiod dans python Interpr\u00e9teur en ligne , python3 on va reprendre le montage [&hellip;]","og_url":"https:\/\/workboot.fr\/ciela\/rpi_2-python-avec-rpi\/","og_site_name":"workboot","article_modified_time":"2025-12-03T09:41:20+00:00","og_image":[{"width":200,"height":200,"url":"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/Raspberry.jpeg","type":"image\/jpeg"}],"twitter_misc":{"Dur\u00e9e de lecture estim\u00e9e":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/workboot.fr\/ciela\/rpi_2-python-avec-rpi\/","url":"https:\/\/workboot.fr\/ciela\/rpi_2-python-avec-rpi\/","name":"RPI_2 Python - workboot","isPartOf":{"@id":"https:\/\/workboot.fr\/ciela\/#website"},"primaryImageOfPage":{"@id":"https:\/\/workboot.fr\/ciela\/rpi_2-python-avec-rpi\/#primaryimage"},"image":{"@id":"https:\/\/workboot.fr\/ciela\/rpi_2-python-avec-rpi\/#primaryimage"},"thumbnailUrl":"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/Raspberry.jpeg","datePublished":"2025-07-28T09:08:45+00:00","dateModified":"2025-12-03T09:41:20+00:00","inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/workboot.fr\/ciela\/rpi_2-python-avec-rpi\/"]}]},{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/workboot.fr\/ciela\/rpi_2-python-avec-rpi\/#primaryimage","url":"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/Raspberry.jpeg","contentUrl":"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/Raspberry.jpeg","width":200,"height":200},{"@type":"WebSite","@id":"https:\/\/workboot.fr\/ciela\/#website","url":"https:\/\/workboot.fr\/ciela\/","name":"workboot","description":"Open Source, Open Minds ","publisher":{"@id":"https:\/\/workboot.fr\/ciela\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/workboot.fr\/ciela\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"fr-FR"},{"@type":"Organization","@id":"https:\/\/workboot.fr\/ciela\/#organization","name":"workboot","url":"https:\/\/workboot.fr\/ciela\/","logo":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/workboot.fr\/ciela\/#\/schema\/logo\/image\/","url":"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/05\/logo_ciel-dorian-1.png","contentUrl":"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/05\/logo_ciel-dorian-1.png","width":1024,"height":950,"caption":"workboot"},"image":{"@id":"https:\/\/workboot.fr\/ciela\/#\/schema\/logo\/image\/"}}]}},"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"admin","author_link":"https:\/\/workboot.fr\/ciela\/author\/admin\/"},"uagb_comment_info":0,"uagb_excerpt":"\ud83d\udd52 : 3 h maximum Pr\u00e9requis: But: R\u00e9pertoire du travail: ~\/Works\/RPI_2 Installation installer la lib pour utiliser libgpiod dans python Interpr\u00e9teur en ligne , python3 on va reprendre le montage [&hellip;]","_links":{"self":[{"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/pages\/3153","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/comments?post=3153"}],"version-history":[{"count":30,"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/pages\/3153\/revisions"}],"predecessor-version":[{"id":5571,"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/pages\/3153\/revisions\/5571"}],"wp:attachment":[{"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/media?parent=3153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}