Go Down

Topic: Live feed servo: Arduino Uno. So far I am a beginner, need guidance. (Read 4288 times) previous topic - next topic


I just started using the Arduino Uno, and have already attatched a servo to it. I made a program from scratch, and so far it is working; however, all it can do so far is the same thing over and over whenever I press the RESET button. I would like to know if there is any way to allow my starter kit to accept live feed from a computer (arrow keys?) or another device (possibly a sensor, either 1 or 0) that triggers a response. Is there a specific piece of hardware or a new computer language I need?
All criticism and advice is welcome.

So far, this is what I have for my servo--stored on the microprocessor:
Code: [Select]
#include <Servo.h>
Servo servol;
void setup()
void loop()
  int position;
  for (position = 0; position < 90; position++ )
  while (1) {}

Help, please?


Connect a potentiometer to an analog input.  On end to 5V other end to ground and center to analog input.  Read analog input to a variable.  Map analog input range to servo range (map(Ain,0,1023,0,180).  Control servo position with potentiometer.


Thanks! Going to try it out tomorrow as soon as possible. I never thought about using a potentiometer!

But, theoretically, how would you use arrow keys on your computer?


I don't know how to use the arrow keys with serial monitor.  You could use the number keys  on the numeric keypad though.  You set up the serial port on the Arduino and receive the keys from the serial monitor and have the servo act on different keys. 

Go Up