Go Down

Topic: How to set up Arduino Uno to receive inputs from a computer? (Read 614 times) previous topic - next topic

chrmat5

I am working on trying to get a robotic arm to move in relation to brainwave signals, and have a program that can output keystrokes when brainwave patterns are recognized, but I am not sure how to send this signal to the Uno itself. I thought I could send the signals through the USB cable, but I can't really find documentation on how to do that. If I were to get certain shields, would that make it easier to send signals from the computer to the Uno, or am I just missing something basic? Any help would be much appreciated.
 

CrossRoads

Connect Uno via serial cable to the PC.

Have sketch check for PC output, act on what's received:
Code: [Select]

void loop(){
if (Serial.avaliable()>0){
 keystroke = Serial.read();
 }
// do something based on keystroke recieved
}

This is simplest, you might want to look for something longer, or for certain variables, or send a message back, etc.
Can't help you on the PC side.
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

zenwebb

Your PC can communicate to the board anytime using a Serial connection via the USB cable.

There is a lot of great documentation under the "4. Communication" header on this page: http://arduino.cc/en/Tutorial/HomePage

For example, http://arduino.cc/en/Tutorial/ReadASCIIString

You can use any language you want to make the Serial connection, from Processing to C++ to Python.
Grad student, creative technologist, OSHW engineer
http://jason-webb.info

mrTee

Or you could use this Serial messaging library for C# http://forum.arduino.cc/index.php?topic=186928.0. C# is a very easy and powerful language.

Disclaimer: I wrote the library, so I might be biased :P

Go Up