Modifications

Sauter à la navigation Sauter à la recherche
Ligne 124 : Ligne 124 :  
== Activer une broche comme sortie ==
 
== Activer une broche comme sortie ==
   −
To set  a pin as output, you also need two lines of code:  
+
Pour activer une broche comme une sortie ("''output''" en anglais), vous avez besoin d'utiliser deux lignes de code:  
   −
  <nowiki># Set pin 0 to output (you can set pins 0..15 this way)
+
  <nowiki># Activer la broche 0 comme sortie/output
 +
# (vous pouvez initialiser les broches de 0 à 15 de cette facon)
 
mcp.config(0, OUTPUT)
 
mcp.config(0, OUTPUT)
   −
# Set pin 0 High
+
# assigner la sortie 0 - état haut/High
 
mcp.output(0, 1)   
 
mcp.output(0, 1)   
   −
# Set pin 0 Low
+
# Assigner la sortie 0 - état bas/Low
 
mcp.output(0, 0)</nowiki>
 
mcp.output(0, 0)</nowiki>
   −
That's all there is to itThe default sample code will toggle the GPIO pin as fast as possible, and if you hooked it up to an oscilloscope you'd end up with something similar to the following:  
+
C'est tout ce qu'il faut faireLe code d'exemple essaye de basculer la broche GPIO aussi vite que possible... et si vous y branchez un oscilloscope vous devriez voir quelquechose comme ce qui suit:  
    
{{#Widget:Iframe
 
{{#Widget:Iframe
29 917

modifications

Menu de navigation