Show Posts
Pages: [1] 2
1  Using Arduino / Programming Questions / Re: adding serial commands to code for remote control on: January 11, 2013, 06:50:50 pm
agreed but there is also a difference between being lazy and seeking help because i simply dont understand the serial code tags if you will and due to previous failures i dont want to give up because it is rather interesting process.
2  Using Arduino / Programming Questions / Re: adding serial commands to code for remote control on: January 09, 2013, 04:47:41 pm
That makes a little bit of sense but how you structure the code for the transmitter an receiver ? sorry am a complete noob when it comes to coding...

thanks
3  Using Arduino / Programming Questions / Re: adding serial commands to code for remote control on: January 08, 2013, 08:50:48 pm
http://gravitech.us/xbadforarna.html is the sheild im using with an adduino nano and xbees
4  Using Arduino / Programming Questions / Re: adding serial commands to code for remote control on: January 08, 2013, 08:42:24 pm
Via xbee radios
5  Using Arduino / Programming Questions / adding serial commands to code for remote control on: January 08, 2013, 06:39:21 pm
i am a noob and i have some code for my motors but i need help adding serial commands to it so i can transmit from one arduino to another for remote control of motors. could someone please help get me started in the right direction for both the transmitter and receiver, i would greatly appreciate the help.

Code:
#include <Stepper.h>
 
const int stepsPerRevolution = 64;
 
Stepper pan(stepsPerRevolution, 8,10,9,11);
Stepper tilt(stepsPerRevolution, 3,5,4,6);
 
void setup() {
 
  pan.setSpeed(300);
  tilt.setSpeed(300):
}
 
 
void loop() {
 
  int sensorReading = analogRead(A0); // X-axis
 
  if (sensorReading < 300) { pan.step(2); }   // left
  if (sensorReading > 800) { pan.step(-2); }  // right
 
  int sensorReading2 = analogRead(A1); // Y-axis
 
  if (sensorReading2 < 300) { tilt.step(2); } // down
  if (sensorReading2 > 800) { tilt.step(-2); } // up
   
   
 }

thanks for your help
6  Using Arduino / Programming Questions / help with adding if statements to servo control code on: December 18, 2012, 02:31:49 pm
hello all,

i am a noob, and im having difficultly understanding the if statements needed to keep my servos at a commanded point when using a spring centered joystick. i have all servos doing what they are supposed to do using simple servo libs. its just that when i get the camera to where i want it and release the stick, it automatically recenters bc of the potentiometer reading going back to the middle. 2 of the 4 servos that do that are actually what i need, lol happened by default. But the pan and tilt are the two that i would like stay in the last position that i directed them to until i move them left/right or up/down again. i have been reading about the conditional "IF" and havent found a clear tutorial on it yet, so i need some guidance on this issue. the code that i use is below and again it is very simple.

#include <Servo.h>

Servo panServo; // Create a servo object for the pan (horizontal) servo
Servo tiltServo; // Create a servo object for the tilt (vertical) servo
Servo zoomServo; // Create a servo object for zoom (left/right) servo
Servo downServo; // Create a servo obhect for torch (down/up) servo

int panPin = 0; // Analog input for the joystick pan axis
int tiltPin = 1; // Analog input for the joystick tiltl axis
int zoomPin = 2; // Analog input for the zoom joystick axis
int downPin = 3; // Analog input for the down axis

int tiltVal; // Value read from the vertical axis
int panVal; // Value read from the horizontal axis
int zoomVal; // Value read from the zoom axis
int downVal; // Value read from the down axis

void setup()
{
panServo.attach(9); // use pin 9 PWM output for pan servo
tiltServo.attach(10); // use pin 10 PWM output for tilt servo
zoomServo.attach(6); // use pin 6 PWM output for zoom servo
downServo.attach(5); // use pin 5 PWM output for down servo
}

void loop ()
{
panVal = analogRead(panPin); // read pan joystick position
panVal = map(panVal, 0, 1023, 0, 179); // scale reading to servo
panServo.write(panVal); //move servo to required position

tiltVal = analogRead(tiltPin); // read pan joystick position
tiltVal = map(tiltVal, 0, 1023, 0, 179); // scale reading to servo
tiltServo.write(tiltVal); //move servo to required postion

zoomVal = analogRead(zoomPin); // read zoom joystick position
zoomVal = map(zoomVal, 0, 1023, 0, 179); // scale reading to servo
zoomServo.write(zoomVal); //move servo to required position

downVal = analogRead(downPin); // read record joystick position
downVal = map(downVal, 0, 1023, 0, 179); // scale reading to servo
downServo.write(downVal); //move servo to required position
}

thanks in advance
7  Using Arduino / Motors, Mechanics, and Power / Re: 28BYJ-48 geared stepper 64 or 32 steps. on: December 18, 2012, 02:27:28 am
i have 2 of these on a camera setup and here is the code i have that runs them off of 1 joystick.

#include <Stepper.h>
 
const int stepsPerRevolution = 64; 
 
Stepper pan(stepsPerRevolution, 8,10,9,11);
Stepper tilt(stepsPerRevolution, 3,5,4,6);
 
void setup() {
 
  pan.setSpeed(300);    // pan
  tilt.setSpeed(300);   // tilt
}
 
 void loop() {
 
  int sensorReading = analogRead(A0); // pan
 
  if (sensorReading < 300) { pan.step(4); }   // pan left
  if (sensorReading > 800) { pan.step(-4); }  // pan right
 
  int sensorReading2 = analogRead(A1); // tilt
 
  if (sensorReading2 < 300) { tilt.step(4); } // motion down
  if (sensorReading2 > 800) { tilt.step(-4); } // motion up
   
   
 }

simple and easy
good luck
8  Using Arduino / Motors, Mechanics, and Power / Re: 2 Stepper motors with drivers - Help on: December 18, 2012, 01:38:25 am
this is very simple code i put together for roughly the same thing, im not sure what motors/driver combo your using but this works very well for me. youll more than likely need to change the variables bc i have fine tuned them for my system. good luck!!

#include <Stepper.h>
 
const int stepsPerRevolution = 64; 
 
Stepper pan(stepsPerRevolution, 8,10,9,11);
Stepper tilt(stepsPerRevolution, 3,5,4,6);
 
void setup() {
 
  pan.setSpeed(300);    // pan
  tilt.setSpeed(300);   // tilt
}
 
 void loop() {
 
  int sensorReading = analogRead(A0); // pan
 
  if (sensorReading < 300) { pan.step(4); }   // pan left
  if (sensorReading > 800) { pan.step(-4); }  // pan right
 
  int sensorReading2 = analogRead(A1); // tilt
 
  if (sensorReading2 < 300) { tilt.step(4); } // motion down
  if (sensorReading2 > 800) { tilt.step(-4); } // motion up
   
   
 }
9  Topics / Robotics / Re: Pan/Tilt Camera on: December 15, 2012, 10:36:26 am
http://lightake.com/detail.do/sku.28YBT_48_DC_5V_Stepper_Motor_with_ULN2003_Driver-58588  is the motor and driverboard that i bought for the camera setup.
10  Using Arduino / Motors, Mechanics, and Power / Re: battery life help on: December 14, 2012, 12:09:35 pm
i ordered some A systems 123 batteries and together there set up for 7.2 v @ roughly 4000 maH and it lasted for around 6.2 hrs (far exceeded my expectations but a little on the costly side, but works awesome) so it was the nicd battery that was having issues but it still confuses me as to why the 12v batteries would push it for longer than 2.25 hrs, both of those batteries are actually 12.6v and 1500 maH.

11  Topics / Robotics / Re: Pan/Tilt Camera on: December 13, 2012, 06:12:42 pm
well i broke a servo because it couldnt take the weight, i ordered 2 28BYJ-48 5V Stepper Motorx and ULN2003 driver boards. From what ive read these are actually quite nice for the price and pretty straight forward to hook up and will accomplish what im am looking to do and possibly be a little more stable than the servo setup. I have to learn how to code now, have you ever hooked used a stepper motor and driver controller?
12  Using Arduino / Motors, Mechanics, and Power / battery life help on: December 11, 2012, 09:48:00 pm
Voltage questions, i have a home built controller that runs for exactly 2:25 hrs whether its on a (1) 12v 1300ma battery, or 2 12v 1300ma batteries (doubling the ma) or a 9.2v 3800 ma battery. my goal is to get to 3.5 hrs. my draw is 640-670 ma depending on load.

how do i extend the lfe time of the controller?

thanks in advance
13  Topics / Robotics / Re: Pan/Tilt Camera on: December 11, 2012, 01:49:27 am
Again thanks for your quick responses, i greatly appreciate your help. i will hook the unit up as you stated and upload the sketch and see what happens and keep you in the loop and also do a little reading up on the un/conditional "IF" in the morning. Im debating on just not even worrying about the button depress to center bc its really easy to depress that button on the ps2 controller joystick and i would not want it to recenter while looking around, just a thought. there is so much more than i originally thought that goes into this, but at the same time you learn so much more. lol

thanks again good sir
captain
14  Topics / Robotics / Re: Pan/Tilt Camera on: December 11, 2012, 12:22:53 am
thank you for your quick replies, pardon my...ineptness on the matter but could you expound on the conditional IF and non conditional IF. once again im new to this and have the slightest clue to what you are talking about. i will google the conditional IF and the non conditional IF to further my knowledge but your advice would be greatly appreciated.

Thanks again
15  Topics / Robotics / Re: Pan/Tilt Camera on: December 09, 2012, 05:11:17 pm
http://www.instructables.com/id/Arduino-Servo-Dual-Mode-Control-PanTilt-with-Jo/  this link has a great video that is what im looking to do except the led blinking.
Pages: [1] 2