Modifications

Sauter à la navigation Sauter à la recherche
202 octets supprimés ,  21 septembre 2018 à 19:49
Ligne 25 : Ligne 25 :     
== Serial ou SerialUSB ==
 
== Serial ou SerialUSB ==
99.9% des croquis Arduino existant utilise '''Serial.print''' pour sortie de débogage ou sortie console. Sur un Arduino SAMD/M0 officiel, cette instruction utilise le port Serial5, qui n'est pas exposé sur un Feather.  
+
99.9% of Arduino Sketch does use '''Serial.print''' for debugging purpose (or serial output). On the official SAMD/M0 Arduino, this instruction use the Serial5 port which is not exposed on a Feather.  
   −
A la place, le port USB d'un Arduino M0 officiel est appelé '''SerialUSB'''.
+
Instead, the USB port on official Arduino M0 is called '''SerialUSB'''.
   −
Sur un Adafruit M0, Adafruit a corrigé cela de sortie que Serial est dirigé vers l'USB lorsque vous utilisez un Feather M0 (et donc tout fonctionne correctement automatiquement).
+
Adafruit did fix this on the Adafruit M0 by redirecting Serial call to USB calls. So, when using a Feather M0 everything appears to work to properly without requiring any changes.
   −
{{ambox|text=Cependant, si vous utilisez un Arduino SAMD officiel, et non une version Adafruit (nous recommandons une carte Adafruit car, comme vous pouvez le voir, il y a des différences), il faudra alors utiliser SerialUSB à la place de Serial pour envoyer le résultat des instructions "print" sur le port USB.}}
+
{{ambox|text=However, if you want to use a, official Arduino SAMD, you will have to use {{fname|SerialUSB}} instead of {{fname|Serial}}. So the Adafruit produit is better on this point.}}
   −
Si vous avez des croquis existants et que vous désirez le faire fonctionner sur un M0 sans occasionner de nombreuses opérations de remplacement, placez le code suivant:
+
If you want to use an official M0 without the need to change all the {{fname|Serial.print()}} call to {{fname|SerialUSB.print()}} , then place the following code:
    
<syntaxhighlight lang="c">
 
<syntaxhighlight lang="c">
 
#if defined(ARDUINO_SAMD_ZERO) && defined(SERIAL_PORT_USBVIRTUAL)
 
#if defined(ARDUINO_SAMD_ZERO) && defined(SERIAL_PORT_USBVIRTUAL)
   // requis pour les opérations Serial sur les cartes à base de Zero
+
   // required for Serial operations on Zero based board
 
   #define Serial '''SERIAL_PORT_USBVIRTUAL'''
 
   #define Serial '''SERIAL_PORT_USBVIRTUAL'''
 
#endif
 
#endif
 
</syntaxhighlight>
 
</syntaxhighlight>
   −
'''juste au dessus de la première''' définition de fonction dans votre code.
+
'''just before the first''' function definition in the code.
   −
Par exemple:
+
Example:
    
{{ADFImage|FEATHER-M0-ArduinoIDE-Croquis-01.png|640px}}
 
{{ADFImage|FEATHER-M0-ArduinoIDE-Croquis-01.png|640px}}
29 836

modifications

Menu de navigation