Modifications

Sauter à la navigation Sauter à la recherche
Ligne 27 : Ligne 27 :  
Approche qui à au moins le bénéfice d'être rétro-compatible avec AVR.
 
Approche qui à au moins le bénéfice d'être rétro-compatible avec AVR.
   −
== Serial vs SerialUSB ==
+
== Serial ou SerialUSB ==
99.9% of your existing Arduino sketches use '''Serial.print''' to debug and give output. For the Official Arduino SAMD/M0 core, this goes to the Serial5 port, which isn't exposed on the Feather. The USB port for the Official Arduino M0 core, is called '''SerialUSB''' instead.
+
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.  
   −
In the Adafruit M0 Core, we fixed it so that Serial goes to USB when you use a Feather M0 so it will automatically work just fine.
+
A la place, le port USB d'un Arduino M0 officiel est appelé '''SerialUSB'''.
   −
'''However, on the off chance you are using the official Arduino SAMD core not the Adafruit version (which really, we recommend you use our version because as you can see it can vary) & you want your Serial prints and reads to use the USB port, use SerialUSB instead of Serial in your sketch'''
+
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).
   −
If you have existing sketches and code and you want them to work with the M0 without a huge find-replace, put
+
{{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.}}
   −
<code>#if defined(ARDUINO_SAMD_ZERO) && defined(SERIAL_PORT_USBVIRTUAL)<br>   // Required for Serial on Zero based boards<br>   #define Serial '''SERIAL_PORT_USBVIRTUAL'''<br> #endif</code>
+
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:
   −
'''right above the first''' function definition in your code. For example:
+
<syntaxhighlight lang="c">
 +
#if defined(ARDUINO_SAMD_ZERO) && defined(SERIAL_PORT_USBVIRTUAL)
 +
  // requis pour les opérations Serial sur les cartes à base de Zero
 +
  #define Serial '''SERIAL_PORT_USBVIRTUAL'''
 +
#endif
 +
</syntaxhighlight>
 +
 
 +
'''juste au dessus de la première''' définition de fonction dans votre code.
 +
 
 +
Par exemple:
    
{{ADFImage|FEATHER-M0-ArduinoIDE-Croquis-01.png|640px}}
 
{{ADFImage|FEATHER-M0-ArduinoIDE-Croquis-01.png|640px}}
29 917

modifications

Menu de navigation