1

Am I able to send instruction from my computer, from another compiler, via the Arduino USB port?

To put this in context, I'm doing some vision processing on my computer, with Visual Studio, and I want to send some motor output via USB for the Arduino to execute.

0
1

I imagine Code Gorilla's given you the proper, specific answer you needed. I simply wanted to address your first (more general) ask,

Am I able to send instruction from my computer, from another compiler, via the Arduino USB port?

... and mention some other ways I've done this before. As long the Arduino's listening to the serial port for some specific (or any) input coming in, you can use whatever you'd like to send a message to the COM port your Arduino's using.

You absolutely are not hemmed into using solely the Arduino IDE (or it's serial monitor) for serial communication.

For instance, I wrote a Python script that communicated with an Arduino R3 (Rx/Tx) via the COM port it was assigned via the PySerial library - before coming to Python, I'd been doing this through a MS Visual C# WPF that was connected to the COM port and communicating with the Arduino (Rx/Tx) (you might need to adjust baud rates here or there, if I recall). Just to give you some ideas.

0

You can do it in a number of ways, but essentially your PC is going to open a serial connection to the Arduino and send data to it which will be interpreted into state changes of the digital ports of the Arduino. The content of the messages is up to you, as long as both ends know what it means.

Step 1 would be to learn how to drive the motors on the Arduino by writing a program that drives the correct ports.

Step 2 is to modify that program so that when you type 1180 in to the serial monitor the Arduino turns motor 1 180 degrees, etc.

Step 3 Start Visual Studio, press F1 and search MSDN for a Serial console program that you can 'borrow'.

Step 4 Check your new serial program can replace the serial monitor and you can still turn motor 1 to 180 degrees.

Step 5 Put a flowery GUI over you serial console and polish your turd. :)

It doesn't matter what the GUI does, its still just a serial client talking to the Arduino. You could offer Bluetooth or Wi-Fi connections, but its essentially the same beast.

-3

Assuming your project is along the lines of "finding something and pointing at it".

This youtube video shows an eye mounted on a stalk apparently controlled by servo motors (a type of positioning motor). The title infers an Arduino controls the motors and is in turned controlled by desktop computer running a program making use of OpenCV libraries. However no details are given.

An Arduino Uno is perfect for controlling servo motors as it contains a dedicated Atmel embedded processor. And there are Arduino servo libraries which make use of the Arduino processor's PWM hardware. This means controlling a servo can be as simple as several line of Arduino sketch code.

myservo.attach(2);  // attaches the servo on pin 2 to the servo object 
myservo.write(0);   // sets the servo position to 0 
delay(1000);        // waits for a second
myservo.write(90);  // sets the servo position to 90 
delay(1000);        // waits for a second
myservo.write(180); // sets the servo position to 180 

The USB port of an Arduino Uno normally implements serial port protocol layer inside the USB layer. Many computers can deal with this easily. So sending messages to an Arduino Uno is possible. Here is a project (Arduino Playground - Simple Servo Control tutorial) where a (desktop) computer is controlling servo motors connected to an Arduino over the Arduino's USB port.

3
  • 2
    Could you provide the key points from the link you mention. Thanks. – sa_leinad Jun 2 '17 at 14:38
  • 2
    Merely posting a link dose not constitute an answer under the rules of the stack exchange system. If that's all you are going to do, you should post a comment. – Chris Stratton Jun 2 '17 at 15:09
  • I did not know that. Thought direct was better. Ok, changing. – st2000 Jun 3 '17 at 1:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.