{"id":250,"date":"2019-07-08T17:02:50","date_gmt":"2019-07-08T15:02:50","guid":{"rendered":"http:\/\/www.boichat.ch\/wpjrsp\/?p=250"},"modified":"2019-12-14T17:55:09","modified_gmt":"2019-12-14T16:55:09","slug":"programmez-en-java-sans-le-pi4j","status":"publish","type":"post","link":"https:\/\/www.boichat.ch\/wpjrsp\/2019\/07\/08\/programmez-en-java-sans-le-pi4j\/","title":{"rendered":"Programmez en Java sans le Pi4J"},"content":{"rendered":"<p><strong><em>Date de la derni\u00e8re modification: 14 d\u00e9cembre 2019<\/em><\/strong><\/p>\n<p>Le chapitre 13 du livre,\u00a0\u00a0<span style=\"font-size: 14pt;\"><strong>Ex\u00e9cuter des scripts Python depuis Java<\/strong><\/span>, nous montre comment ex\u00e9cuter le script Python\u00a0<strong>blinkleds.py<\/strong>\u00a0et faire ensuite clignoter les deux LEDs d\u00e9finis sur notre planche \u00e0 pain:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-78\" src=\"https:\/\/www.boichat.ch\/wpjrsp\/wp-content\/uploads\/2018\/10\/RaspberryPi2-300x266.jpg\" alt=\"\" width=\"300\" height=\"266\" srcset=\"https:\/\/www.boichat.ch\/wpjrsp\/wp-content\/uploads\/2018\/10\/RaspberryPi2-300x266.jpg 300w, https:\/\/www.boichat.ch\/wpjrsp\/wp-content\/uploads\/2018\/10\/RaspberryPi2-768x682.jpg 768w, https:\/\/www.boichat.ch\/wpjrsp\/wp-content\/uploads\/2018\/10\/RaspberryPi2.jpg 927w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>Ensuite, en utilisant la classe Java\u00a0<strong>ProcessBuilderPython<\/strong> d\u00e9crite dans ce chapitre 13, nous montrons comment, depuis Java:<\/p>\n<ul>\n<li>passer le nombre de clignotement;<\/li>\n<li>ex\u00e9cuter depuis Java le script Python <strong>blinkleds.py<\/strong>;<\/li>\n<li>v\u00e9rifier le bon fonctionnement et finalement;<\/li>\n<li>recevoir un r\u00e9sultat en forme de texte.<\/li>\n<\/ul>\n<p><strong>Nous pourrions donc \u00e9crire un ensemble de scripts Python pour dialoguer avec nos composants GPIO, sans utiliser l&rsquo;interface et\u00a0<a href=\"http:\/\/pi4j.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">le logiciel Pi4J<\/a>\u00a0en Java.<\/strong> Les temps de r\u00e9ponses devraient sans doute \u00eatre adapt\u00e9s et le travail pour convertir tous les exemples et applications du livre pourrait prendre des semaines de travail!<\/p>\n<p>Cela resterait un exercice ludique assez int\u00e9ressant avec une part plus importante au langage Python. Dans ce cas <a href=\"https:\/\/www.boichat.ch\/wpjrsp\/2018\/10\/31\/extension-plugin-pydev-pour-eclipse\/\" target=\"_blank\" rel=\"noopener noreferrer\">l&rsquo;utilisation de PyDev<\/a> serait sans doute indispensable.<\/p>\n<p>J\u2019essaierai sans doute de mettre quelques exemples ici qui correspondraient \u00e0 une extension de la classe <strong>ProcessBuilderPython<\/strong>.<\/p>\n<p>Une interface fichier serait possible aussi. Le chapitre 18 d\u00e9di\u00e9 au senseur de temp\u00e9rature, le Dallas DS18B20, n&rsquo;utilise pas le <strong>Pi4J<\/strong>\u00a0.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Le chapitre 13 du livre,\u00a0\u00a0Ex\u00e9cuter des scripts Python depuis Java, nous montre comment ex\u00e9cuter le script Python\u00a0blinkleds.py\u00a0et faire ensuite clignoter les deux LEDs d\u00e9finis sur&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"footnotes":""},"categories":[1],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v17.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Programmez en Java sans le Pi4J - Un livre sur Java, Python, Eclipse et le Raspberry Pi 3<\/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:\/\/www.boichat.ch\/wpjrsp\/2019\/07\/08\/programmez-en-java-sans-le-pi4j\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Programmez en Java sans le Pi4J - Un livre sur Java, Python, Eclipse et le Raspberry Pi 3\" \/>\n<meta property=\"og:description\" content=\"Le chapitre 13 du livre,\u00a0\u00a0Ex\u00e9cuter des scripts Python depuis Java, nous montre comment ex\u00e9cuter le script Python\u00a0blinkleds.py\u00a0et faire ensuite clignoter les deux LEDs d\u00e9finis sur&hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.boichat.ch\/wpjrsp\/2019\/07\/08\/programmez-en-java-sans-le-pi4j\/\" \/>\n<meta property=\"og:site_name\" content=\"Un livre sur Java, Python, Eclipse et le Raspberry Pi 3\" \/>\n<meta property=\"article:published_time\" content=\"2019-07-08T15:02:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-12-14T16:55:09+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.boichat.ch\/wpjrsp\/wp-content\/uploads\/2018\/10\/RaspberryPi2-300x266.jpg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u00c9crit par\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jean-Bernard Boichat\" \/>\n\t<meta name=\"twitter:label2\" content=\"Dur\u00e9e de lecture estim\u00e9e\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.boichat.ch\/wpjrsp\/#website\",\"url\":\"https:\/\/www.boichat.ch\/wpjrsp\/\",\"name\":\"Un livre sur Java, Python, Eclipse et le Raspberry Pi 3\",\"description\":\"Jean-Bernard Boichat - Auteur chez Eyrolles\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.boichat.ch\/wpjrsp\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"fr-FR\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.boichat.ch\/wpjrsp\/2019\/07\/08\/programmez-en-java-sans-le-pi4j\/#primaryimage\",\"inLanguage\":\"fr-FR\",\"url\":\"http:\/\/www.boichat.ch\/wpjrsp\/wp-content\/uploads\/2018\/10\/RaspberryPi2-300x266.jpg\",\"contentUrl\":\"http:\/\/www.boichat.ch\/wpjrsp\/wp-content\/uploads\/2018\/10\/RaspberryPi2-300x266.jpg\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.boichat.ch\/wpjrsp\/2019\/07\/08\/programmez-en-java-sans-le-pi4j\/#webpage\",\"url\":\"https:\/\/www.boichat.ch\/wpjrsp\/2019\/07\/08\/programmez-en-java-sans-le-pi4j\/\",\"name\":\"Programmez en Java sans le Pi4J - Un livre sur Java, Python, Eclipse et le Raspberry Pi 3\",\"isPartOf\":{\"@id\":\"https:\/\/www.boichat.ch\/wpjrsp\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.boichat.ch\/wpjrsp\/2019\/07\/08\/programmez-en-java-sans-le-pi4j\/#primaryimage\"},\"datePublished\":\"2019-07-08T15:02:50+00:00\",\"dateModified\":\"2019-12-14T16:55:09+00:00\",\"author\":{\"@id\":\"https:\/\/www.boichat.ch\/wpjrsp\/#\/schema\/person\/fe6328cc5b74b8a6e8d841285a928751\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.boichat.ch\/wpjrsp\/2019\/07\/08\/programmez-en-java-sans-le-pi4j\/#breadcrumb\"},\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.boichat.ch\/wpjrsp\/2019\/07\/08\/programmez-en-java-sans-le-pi4j\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.boichat.ch\/wpjrsp\/2019\/07\/08\/programmez-en-java-sans-le-pi4j\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.boichat.ch\/wpjrsp\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Programmez en Java sans le Pi4J\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.boichat.ch\/wpjrsp\/#\/schema\/person\/fe6328cc5b74b8a6e8d841285a928751\",\"name\":\"Jean-Bernard Boichat\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.boichat.ch\/wpjrsp\/#personlogo\",\"inLanguage\":\"fr-FR\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/862886ce35a52b9d13595e18ac3c3ea5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/862886ce35a52b9d13595e18ac3c3ea5?s=96&d=mm&r=g\",\"caption\":\"Jean-Bernard Boichat\"},\"sameAs\":[\"http:\/\/www.boichat.ch\"],\"url\":\"https:\/\/www.boichat.ch\/wpjrsp\/author\/bjb\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Programmez en Java sans le Pi4J - Un livre sur Java, Python, Eclipse et le Raspberry Pi 3","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:\/\/www.boichat.ch\/wpjrsp\/2019\/07\/08\/programmez-en-java-sans-le-pi4j\/","og_locale":"fr_FR","og_type":"article","og_title":"Programmez en Java sans le Pi4J - Un livre sur Java, Python, Eclipse et le Raspberry Pi 3","og_description":"Le chapitre 13 du livre,\u00a0\u00a0Ex\u00e9cuter des scripts Python depuis Java, nous montre comment ex\u00e9cuter le script Python\u00a0blinkleds.py\u00a0et faire ensuite clignoter les deux LEDs d\u00e9finis sur&hellip;","og_url":"https:\/\/www.boichat.ch\/wpjrsp\/2019\/07\/08\/programmez-en-java-sans-le-pi4j\/","og_site_name":"Un livre sur Java, Python, Eclipse et le Raspberry Pi 3","article_published_time":"2019-07-08T15:02:50+00:00","article_modified_time":"2019-12-14T16:55:09+00:00","og_image":[{"url":"http:\/\/www.boichat.ch\/wpjrsp\/wp-content\/uploads\/2018\/10\/RaspberryPi2-300x266.jpg"}],"twitter_card":"summary_large_image","twitter_misc":{"\u00c9crit par":"Jean-Bernard Boichat","Dur\u00e9e de lecture estim\u00e9e":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/www.boichat.ch\/wpjrsp\/#website","url":"https:\/\/www.boichat.ch\/wpjrsp\/","name":"Un livre sur Java, Python, Eclipse et le Raspberry Pi 3","description":"Jean-Bernard Boichat - Auteur chez Eyrolles","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.boichat.ch\/wpjrsp\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"fr-FR"},{"@type":"ImageObject","@id":"https:\/\/www.boichat.ch\/wpjrsp\/2019\/07\/08\/programmez-en-java-sans-le-pi4j\/#primaryimage","inLanguage":"fr-FR","url":"http:\/\/www.boichat.ch\/wpjrsp\/wp-content\/uploads\/2018\/10\/RaspberryPi2-300x266.jpg","contentUrl":"http:\/\/www.boichat.ch\/wpjrsp\/wp-content\/uploads\/2018\/10\/RaspberryPi2-300x266.jpg"},{"@type":"WebPage","@id":"https:\/\/www.boichat.ch\/wpjrsp\/2019\/07\/08\/programmez-en-java-sans-le-pi4j\/#webpage","url":"https:\/\/www.boichat.ch\/wpjrsp\/2019\/07\/08\/programmez-en-java-sans-le-pi4j\/","name":"Programmez en Java sans le Pi4J - Un livre sur Java, Python, Eclipse et le Raspberry Pi 3","isPartOf":{"@id":"https:\/\/www.boichat.ch\/wpjrsp\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.boichat.ch\/wpjrsp\/2019\/07\/08\/programmez-en-java-sans-le-pi4j\/#primaryimage"},"datePublished":"2019-07-08T15:02:50+00:00","dateModified":"2019-12-14T16:55:09+00:00","author":{"@id":"https:\/\/www.boichat.ch\/wpjrsp\/#\/schema\/person\/fe6328cc5b74b8a6e8d841285a928751"},"breadcrumb":{"@id":"https:\/\/www.boichat.ch\/wpjrsp\/2019\/07\/08\/programmez-en-java-sans-le-pi4j\/#breadcrumb"},"inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.boichat.ch\/wpjrsp\/2019\/07\/08\/programmez-en-java-sans-le-pi4j\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.boichat.ch\/wpjrsp\/2019\/07\/08\/programmez-en-java-sans-le-pi4j\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.boichat.ch\/wpjrsp\/"},{"@type":"ListItem","position":2,"name":"Programmez en Java sans le Pi4J"}]},{"@type":"Person","@id":"https:\/\/www.boichat.ch\/wpjrsp\/#\/schema\/person\/fe6328cc5b74b8a6e8d841285a928751","name":"Jean-Bernard Boichat","image":{"@type":"ImageObject","@id":"https:\/\/www.boichat.ch\/wpjrsp\/#personlogo","inLanguage":"fr-FR","url":"https:\/\/secure.gravatar.com\/avatar\/862886ce35a52b9d13595e18ac3c3ea5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/862886ce35a52b9d13595e18ac3c3ea5?s=96&d=mm&r=g","caption":"Jean-Bernard Boichat"},"sameAs":["http:\/\/www.boichat.ch"],"url":"https:\/\/www.boichat.ch\/wpjrsp\/author\/bjb\/"}]}},"_links":{"self":[{"href":"https:\/\/www.boichat.ch\/wpjrsp\/wp-json\/wp\/v2\/posts\/250"}],"collection":[{"href":"https:\/\/www.boichat.ch\/wpjrsp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.boichat.ch\/wpjrsp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.boichat.ch\/wpjrsp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.boichat.ch\/wpjrsp\/wp-json\/wp\/v2\/comments?post=250"}],"version-history":[{"count":0,"href":"https:\/\/www.boichat.ch\/wpjrsp\/wp-json\/wp\/v2\/posts\/250\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.boichat.ch\/wpjrsp\/wp-json\/wp\/v2\/media?parent=250"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.boichat.ch\/wpjrsp\/wp-json\/wp\/v2\/categories?post=250"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.boichat.ch\/wpjrsp\/wp-json\/wp\/v2\/tags?post=250"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}