Pages: [1]   Go Down
Author Topic: Live feed servo: Arduino Uno. So far I am a beginner, need guidance.  (Read 2691 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 8
OCT 31 is equal to DEC 25. Therefore, Halloween is Christmas...your argument is invalid.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#include <Servo.h>
Servo servol;
void setup()
{
  servol.attach(9);
}
void loop()
{
  int position;
 
  servol.write(0);
 
  delay(1000);
  for (position = 0; position < 90; position++ )
  {
    servol.write(position);
    delay(70);
  }
  while (1) {}
}

Help, please?
Logged

BCC AZ USA
Offline Offline
Edison Member
*
Karma: 32
Posts: 1129
It gets hot so it must be working
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
OCT 31 is equal to DEC 25. Therefore, Halloween is Christmas...your argument is invalid.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

BCC AZ USA
Offline Offline
Edison Member
*
Karma: 32
Posts: 1129
It gets hot so it must be working
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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. 
Logged

Pages: [1]   Go Up
Jump to: