Answer the question
In order to leave comments, you need to log in
How to write to a file?
Good day, dear Arduino fans,
I need help, please tell me how to make the variable values be written to a file on the computer? arduino connected to usb and defined as com3
int echoPin = 9;
int trigPin = 8;
void setup() {
Serial.begin (9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
}
void loop() {
int duration, cm;
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
cm = duration / 58;
Serial.print(cm);
Serial.println(" cm");
delay(1000);
}
Answer the question
In order to leave comments, you need to log in
Rou1997 Alexander Gusev Can't Arduino write to a file without an intermediary?
It is necessary to write a program for a computer that will "listen" to this COM port, that is, read commands from it and work with the file, well, and Arduino will send certain commands.
It will be necessary to write a program for a computer that will open a COM port with an arduino and will read it, simultaneously writing data to a file. Choose the language of your choice, Qt, for example.
You may even find something ready to read the COM port with the ability to write to a file.
_______
UPD:
You can add an SD card and write to it in a notepad, then insert it into a PC and watch the data.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question