Go Down

Topic: Computer USB file handling (Read 176 times) previous topic - next topic

TakeThat101

I am trying wanting to make a robot that will be using 6 servos to accomplish a certain task.  I will have a list of commands on a file on a computer, and I wanted to know if it is possible to have the computer read the file and generate how the servos need to move, and then send that to the arduino which will then give the signals to the servos.  Is this possible? If so, how would I?

Robin2

Yes. That should be straightforward. You will need to write a PC program to read the file and send the data.

For receiving the data on the Arduino have a look at the examples in Serial Input Basics - simple reliable ways to receive data. There is also a parse example to illustrate how to extract numbers from the received text.

The technique in the 3rd example will be the most reliable.

You can send data in a compatible format with code like this, or its equivalent in any other PC programming language.
Code: [Select]
Serial.print('<'); // start marker
Serial.print(value1);
Serial.print(','); // comma separator
Serial.print(value2);
Serial.println('>'); // end marker




This Python - Arduino demo may be of interest.


...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Go Up