{"id":1911,"date":"2022-12-24T19:17:50","date_gmt":"2022-12-24T18:17:50","guid":{"rendered":"http:\/\/lesmrdtrucs.mataf35400.fr\/?page_id=1911"},"modified":"2022-12-24T19:39:26","modified_gmt":"2022-12-24T18:39:26","slug":"executer-un-programme-python-avec-gpio-sur-un-pc-qui-na-pas-de-gpio","status":"publish","type":"page","link":"https:\/\/lesmrdtrucs.mataf35400.fr\/index.php\/executer-un-programme-python-avec-gpio-sur-un-pc-qui-na-pas-de-gpio\/","title":{"rendered":"Ex\u00e9cuter un programme Python avec GPIO sur un PC qui n&rsquo;a pas de GPIO"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"1911\" class=\"elementor elementor-1911\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-6b2a3c81 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"6b2a3c81\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-7bd3f192\" data-id=\"7bd3f192\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-31c43d14 elementor-widget elementor-widget-text-editor\" data-id=\"31c43d14\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Pris l\u00e0: <a href=\"https:\/\/raspberrypi.stackexchange.com\/questions\/34119\/gpio-library-on-windows-while-developing\" target=\"_blank\" rel=\"noopener\">https:\/\/raspberrypi.stackexchange.com\/questions\/34119\/gpio-library-on-windows-while-developing<\/a><\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-71b3dba elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"71b3dba\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-6fd56e9\" data-id=\"6fd56e9\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-46f8569 elementor-widget elementor-widget-text-editor\" data-id=\"46f8569\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Lorsque l&rsquo;on veut faire tourner sur PC (typiquement MrdTosh) un programme Python pr\u00e9vu pour utiliser le GPIO d&rsquo;un Raspberry Pi, une erreur est lev\u00e9e car le module GPIO n&rsquo;est pas trouv\u00e9.<\/p><p>Une des solutions possibles est de leurrer le programme. Il n&rsquo;y aura plus d&rsquo;erreur, mais, forc\u00e9ment, les instructions pour le GPIO ne seront pas ex\u00e9cut\u00e9es.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-a533481 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"a533481\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-064b4f7\" data-id=\"064b4f7\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-6cfa9ae elementor-widget elementor-widget-text-editor\" data-id=\"6cfa9ae\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div><h3>M\u00e9thode<\/h3><\/div><div>Dans le r\u00e9pertoire du programme Python que l&rsquo;on veut faire tourner, cr\u00e9er un r\u00e9pertoire nomm\u00e9 <span style=\"color: #0000ff;\"><em>RPi<\/em><\/span><\/div><div>Dans ce r\u00e9pertoire RPi, cr\u00e9er un fichier vide nomm\u00e9 <span style=\"color: #0000ff;\"><em>__init__.py<\/em><\/span><\/div><div>Toujours dans ce r\u00e9pertoire RPi, cr\u00e9er un fichier nomm\u00e9 <span style=\"color: #0000ff;\"><em>GPIO.py<\/em><\/span>, dans lequel coller les instructions suivantes:<\/div><p><span style=\"color: #0000ff;\"><em>BOARD = 1<\/em><\/span><br \/><span style=\"color: #0000ff;\"><em>OUT = 1<\/em><\/span><br \/><span style=\"color: #0000ff;\"><em>IN = 1<\/em><\/span><\/p><p><span style=\"color: #0000ff;\"><em>def setmode(a):<\/em><\/span><br \/><span style=\"color: #0000ff;\"><em>\u00a0\u00a0\u00a0 toto=1<\/em><\/span><br \/><span style=\"color: #0000ff;\"><em>def setup(a, b):<\/em><\/span><br \/><span style=\"color: #0000ff;\"><em>\u00a0\u00a0\u00a0 toto=1<\/em><\/span><br \/><span style=\"color: #0000ff;\"><em>def output(a, b):<\/em><\/span><br \/><span style=\"color: #0000ff;\"><em>\u00a0\u00a0\u00a0 toto=1<\/em><\/span><br \/><span style=\"color: #0000ff;\"><em>def input(a, b=0):<\/em><\/span><br \/><span style=\"color: #0000ff;\"><em>\u00a0\u00a0\u00a0 toto=1<\/em><\/span><br \/><span style=\"color: #0000ff;\"><em>def cleanup():<\/em><\/span><br \/><span style=\"color: #0000ff;\"><em>\u00a0\u00a0\u00a0 toto=1<\/em><\/span><br \/><span style=\"color: #0000ff;\"><em>def setwarnings(flag):<\/em><\/span><br \/><span style=\"color: #0000ff;\"><em>\u00a0\u00a0\u00a0 toto=1<\/em><\/span><br \/><span style=\"color: #0000ff;\"><em>def BCM():<\/em><\/span><br \/><span style=\"color: #0000ff;\"><em>\u00a0\u00a0\u00a0 toto=1<\/em><\/span><br \/><span style=\"color: #0000ff;\"><em>def PWM(a, b):<\/em><\/span><br \/><span style=\"color: #0000ff;\"><em>\u00a0\u00a0\u00a0 toto=1<\/em><\/span><\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Pris l\u00e0: https:\/\/raspberrypi.stackexchange.com\/questions\/34119\/gpio-library-on-windows-while-developing Lorsque l&rsquo;on veut faire tourner sur PC (typiquement MrdTosh) un programme Python pr\u00e9vu pour utiliser le GPIO d&rsquo;un Raspberry Pi, une erreur est lev\u00e9e car le module GPIO n&rsquo;est pas trouv\u00e9. Une des solutions possibles est de leurrer le programme. Il n&rsquo;y aura plus d&rsquo;erreur, mais, forc\u00e9ment, les instructions pour le GPIO [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"0","ocean_second_sidebar":"0","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"0","ocean_custom_header_template":"0","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"0","ocean_menu_typo_font_family":"0","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"0","footnotes":""},"class_list":["post-1911","page","type-page","status-publish","hentry","entry"],"_links":{"self":[{"href":"https:\/\/lesmrdtrucs.mataf35400.fr\/index.php\/wp-json\/wp\/v2\/pages\/1911","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lesmrdtrucs.mataf35400.fr\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/lesmrdtrucs.mataf35400.fr\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/lesmrdtrucs.mataf35400.fr\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lesmrdtrucs.mataf35400.fr\/index.php\/wp-json\/wp\/v2\/comments?post=1911"}],"version-history":[{"count":4,"href":"https:\/\/lesmrdtrucs.mataf35400.fr\/index.php\/wp-json\/wp\/v2\/pages\/1911\/revisions"}],"predecessor-version":[{"id":1919,"href":"https:\/\/lesmrdtrucs.mataf35400.fr\/index.php\/wp-json\/wp\/v2\/pages\/1911\/revisions\/1919"}],"wp:attachment":[{"href":"https:\/\/lesmrdtrucs.mataf35400.fr\/index.php\/wp-json\/wp\/v2\/media?parent=1911"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}