Modifications
Sauter à la navigation
Sauter à la recherche
← Modification précédente
Modification suivante →
ENG-CANSAT-MISSION1-RECEIVE
(voir la source)
Version du 30 octobre 2018 à 20:57
612 octets ajoutés
,
30 octobre 2018 à 20:57
→Compile and upload
Ligne 240 :
Ligne 240 :
Then press the "upload" button.
Then press the "upload" button.
+
+
== Capturing data to file ==
+
Having data available in the Arduino Serial Monitor is great... but capturing the content to a file is even better.
+
+
+
=== With Python ===
+
<syntaxhighlight lang="python">
+
import serial
+
+
serial_port = '/dev/ttyACM0';
+
baud_rate = 9600; #In arduino, Serial.begin(baud_rate)
+
write_to_file_path = "output.txt";
+
+
output_file = open(write_to_file_path, "w+");
+
ser = serial.Serial(serial_port, baud_rate)
+
while True:
+
line = ser.readline();
+
line = line.decode("utf-8") #ser.readline returns a binary, convert to string
+
print(line);
+
output_file.write(line);
+
</syntaxhighlight>
{{ENG-CANSAT-TRAILER}}
{{ENG-CANSAT-TRAILER}}
Admin
Bureaucrates
,
Administrateurs
29 836
modifications
Menu de navigation
Outils personnels
Se connecter
Espaces de noms
Page
Discussion
Variantes
Affichages
Lire
Voir le texte source
Voir l’historique
Plus
Rechercher
Navigation
ARDUINO
RASPBERRY-PI
[:: PI Hacking ::]
Particle.IO
Micro Python
Imprimante 3D
Actualités
Modifications récentes
Page au hasard
Aide
Outils
Pages spéciales
Version imprimable