Modifications

Sauter à la navigation Sauter à la recherche
303 octets ajoutés ,  16 mai 2019 à 21:14
Ligne 1 : Ligne 1 :  
{{MicroPython-bluetooth-NAV}}
 
{{MicroPython-bluetooth-NAV}}
   −
= Port série Bluetooth ou REPL BlueTooth =
+
= Port série Bluetooth ou REPL Bluetooth =
 
Dans la partie suivante du tutoriel, nous expliquons comment établir la connexion série depuis un PC (sous Linux) vers le module Bluetooth.
 
Dans la partie suivante du tutoriel, nous expliquons comment établir la connexion série depuis un PC (sous Linux) vers le module Bluetooth.
   Ligne 16 : Ligne 16 :     
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
pyb.repl_uart( pyb.UART(1,9600) )
+
from machine import UART
 +
from os import dupterm
 +
 
 +
uart = UART( 1, 9600 )
 +
dupterm( uart )
 
</syntaxhighlight>
 
</syntaxhighlight>
    
= REPL Bluetooth permanent =
 
= REPL Bluetooth permanent =
 
Si le test est concluant, vous pouvez activer le REPL Bluetooth de façon permanente en saisissant le code suivant en première ligne de votre fichier {{fname|main.py}}  
 
Si le test est concluant, vous pouvez activer le REPL Bluetooth de façon permanente en saisissant le code suivant en première ligne de votre fichier {{fname|main.py}}  
 +
 +
Une bonne idée est d'allumer la LED bleue de la Pyboard. Cela permet de savoir qu'elle est sous tension --ET-- que la connexion USB-Bluetooth est prête.
    
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
pyb.repl_uart( pyb.UART(1,9600) )
+
from machine import UART
 +
from os import dupterm
 +
 
 +
uart = UART( 1, 9600 )
 +
dupterm( uart )
 +
pyb.LED(4).on() # Turn on the Blue LED
 
</syntaxhighlight>
 
</syntaxhighlight>
  
29 922

modifications

Menu de navigation