Arduino Forum

Using Arduino => Interfacing w/ Software on the Computer => Topic started by: andrewlenart on May 19, 2019, 06:40 am

Title: Communication btwn visual studios c++ and Arduino
Post by: andrewlenart on May 19, 2019, 06:40 am
So I made a program on visual studios c++ to detect when my eyes are closed and when they're open. My goal is to turn a servo when they are closed, and not move it when they're open. Question is...how do I get the data that they're closed or open from visual studios, to my Arduino to turn the servos?
Title: Re: Communication btwn visual studios c++ and Arduino
Post by: Robin2 on May 19, 2019, 09:53 am
For receiving data on the Arduino have a look at the examples in Serial Input Basics (http://forum.arduino.cc/index.php?topic=396450.0) - 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. It is what I use for Arduino to Arduino and Arduino to PC communication.

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


...R