From b3c482ccd20f38a538b8f23837bfc6c5404fa524 Mon Sep 17 00:00:00 2001 From: bastien Date: Tue, 16 May 2023 17:14:01 +0200 Subject: [PATCH] Ajouter 'Platform.io cli' --- Platform.io-cli.md | 102 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 Platform.io-cli.md diff --git a/Platform.io-cli.md b/Platform.io-cli.md new file mode 100644 index 0000000..02c38c0 --- /dev/null +++ b/Platform.io-cli.md @@ -0,0 +1,102 @@ +h1. Documentation platformio cli + +h2. "Installation platform.io cli":https://docs.platformio.org/en/latest/core/installation/methods/installer-script.html#super-quick-macos-linux + +Pour l'installation, c'est très simple, juste copié/collé cette commande : +

+python3 -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
+
+ +Ensuite, pour avoir les raccourcis, il faut faire deux trois manipulations faciles : +

+export PATH=$PATH:$HOME/.local/bin
+emulate sh -c '. ~/.profile'
+
+mkdir -p /usr/local/bin
+sudo ln -s ~/.platformio/penv/bin/platformio /usr/local/bin/platformio
+sudo ln -s ~/.platformio/penv/bin/pio /usr/local/bin/pio
+sudo ln -s ~/.platformio/penv/bin/piodebuggdb /usr/local/bin/piodebuggdb
+
+ +Après avoir fini cela, redémarrer l'ordinateur pour qu'il prenne la configuration ci-dessus. + +h3. "Création d'un projet":https://docs.platformio.org/en/latest/core/quickstart.html#board-identifier + +On va créer un dossier pour notre premier projet de teste : +

+mkdir "nom du dossier"
+cd "nom du dossier"
+
+ +Pour initialiser le projet : +

+pio project init --board uno --board nodemcuv2 --board teensy31
+
+ +Si tout va bien normalement, vous devez avoir plusieurs dossiers et un fichier. +Nous allons à présent nous place dans le dossier src et créer un fichier "main.cpp" : +

+vimscode -esp main.cpp
+
+ +Nous allons écrire à l'intérieur : +

+/**
+ * Blink
+ *
+ * Turns on an LED on for one second,
+ * then off for one second, repeatedly.
+ */
+#include "Arduino.h"
+
+#ifndef LED_BUILTIN
+#define LED_BUILTIN 13
+#endif
+
+void setup()
+{
+  // initialize LED digital pin as an output.
+  pinMode(LED_BUILTIN, OUTPUT);
+}
+
+void loop()
+{
+  // turn the LED on (HIGH is the voltage level)
+  digitalWrite(LED_BUILTIN, HIGH);
+
+  // wait for a second
+  delay(1000);
+
+  // turn the LED off by making the voltage LOW
+  digitalWrite(LED_BUILTIN, LOW);
+
+   // wait for a second
+  delay(1000);
+}
+
+ +Et pour téléverser, il faut se placer dans le dossier que vous avez créé : +

+cd ../
+pio run
+
+ ++Si vous avez une erreur telle que :+ +-port inexistant +-port introuvable + +Il faut lancer cette commande : +

+sudo usermod -aG dialout "votre utilisateur"
+
+ +h2. Commandes utiles + +Pour avoir toutes les commandes de platform.io : "Commande platform.io":https://docs.platformio.org/en/latest/core/userguide/index.html#commands + +Pour ajouter des lib : +

+pio pkg search "lib"
+pio pkg install -l "lib"
+pio pkg -h #pour l'aide
+
\ No newline at end of file