Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Would someone be willing to proofread my code? Thanks!! on: April 05, 2011, 01:26:34 am
Quote
// linear actuator brown wire to the right
#include <Servo.h>
 
Servo spoon_servo;
Servo bowl_servo;
int pos = 35; // initialize spoon to serving position

void setup(){
  pinMode(4,OUTPUT); // pin output, spoon extend
  pinMode(8,OUTPUT); // pin output, spoon retract
  pinMode(11,INPUT); // linear actuator limit switch, front
  pinMode(3,INPUT); // linear actuator limit switch, back
  pinMode(12,INPUT); // user input switch, not sure if this line is needed
  pinMode(6,INPUT); // home position rotary switch
  spoon_servo.attach(9);
  spoon_servo.write(pos);
  delay(2000);
  bowl_servo.attach(10);
  bowl_servo.write(90);
  if (digitalRead(6) == HIGH){
      while (digitalRead(11) == LOW) { // fully retract spoon
  digitalWrite(8, HIGH);
  }
  digitalWrite(8, LOW); // stop retracting spoon
  }
  else{      while (digitalRead(3) == LOW) { // fully retract spoon
  digitalWrite(4, HIGH);
  }
  digitalWrite(4, LOW); // stop retracting spoon
  }

}

void loop(){
  if(digitalRead(12) == HIGH) { 
       while (digitalRead(11) == LOW) {
       digitalWrite(8, HIGH); // fully retract spoon
       }
       digitalWrite(8, LOW); // stop retracting spoon   
       delay(1000);     
       spoon_servo.write(120); // rotate spoon into bowl
       delay(1000);
       bowl_servo.write(110); // rotate bowl
       delay(1000);
       bowl_servo.write(90); // stop rotation of bowl
       delay(1000);
       spoon_servo.write(35); // rotate spoon into serving position
       delay(1000);
       while (digitalRead(3) == LOW) {
       digitalWrite(4, HIGH); // fully extend spoon
       }
       digitalWrite(4, LOW); // stop extending spoon       
  }
  else{}
return
}

2  Using Arduino / Project Guidance / Simple Servo Control on: February 14, 2011, 06:53:46 pm
Hi,

I'm trying to control a Hi-Tec hs-645mg servo using the arduino uno.  I copy and paste the sweep code and upload it to the arduino board, setting the code so that the servo will rotate from 60 to 150 degrees.  When I hook up the servo (to an external power supply) it seems to move completely randomly.  All my grounds are tied together as well.

Any help would be greatly appreciated!!

Thanks!!
3  General Category / General Discussion / Cal Poly Engineering Project Assistance Needed on: February 13, 2011, 09:30:55 pm
Hi!

I am currently working on adaptive feeding device for my mechanical engineering senior project.  The device will feed people at the touch of a button.  My team needs to control 2 servo motors and 1 linear actuator for our project.  We need basic help just getting the code started.  The linear actuator needs 12 volts and 1 amp, and the servos need 5-6 volts and 1 amp.  The arduino and the linear actuator are connected to the 12v battery, and the servos are connected to the 5v output of the arduino uno board.  Is this correct or do the servos need a power supply independent of the arduino?

Any basic code help or general tips would be GREATLY APPRECIATED!!!

Thanks very much, look forward to talking with you!

John
Cal Poly Mechanical Engineering
4  Using Arduino / Programming Questions / Cal Poly Senior Project Help Needed!!! on: February 13, 2011, 09:29:55 pm
Hi!

I am currently working on adaptive feeding device for my mechanical engineering senior project.  The device will feed people at the touch of a button.  My team needs to control 2 servo motors and 1 linear actuator for our project.  We need basic help just getting the code started.  The linear actuator needs 12 volts and 1 amp, and the servos need 5-6 volts and 1 amp.  The arduino and the linear actuator are connected to the 12v battery, and the servos are connected to the 5v output of the arduino uno board.  Is this correct or do the servos need a power supply independent of the arduino?

Any basic code help or general tips would be GREATLY APPRECIATED!!!

Thanks very much, look forward to talking with you!

John
Cal Poly Mechanical Engineering
5  Using Arduino / Motors, Mechanics, and Power / Cal Poly Senior Project Assistance Needed!!! on: February 13, 2011, 09:29:05 pm
Hi!

I am currently working on adaptive feeding device for my mechanical engineering senior project.  The device will feed people at the touch of a button.  My team needs to control 2 servo motors and 1 linear actuator for our project.  We need basic help just getting the code started.  The linear actuator needs 12 volts and 1 amp, and the servos need 5-6 volts and 1 amp.  The arduino and the linear actuator are connected to the 12v battery, and the servos are connected to the 5v output of the arduino uno board.  Is this correct or do the servos need a power supply independent of the arduino?

Any basic code help or general tips would be GREATLY APPRECIATED!!!

Thanks very much, look forward to talking with you!

John
Cal Poly Mechanical Engineering
6  Using Arduino / Project Guidance / Cal Poly Senior Project Assistance Needed on: February 13, 2011, 09:27:35 pm
Hi!

I am currently working on adaptive feeding device for my mechanical engineering senior project.  The device will feed people at the touch of a button.  My team needs to control 2 servo motors and 1 linear actuator for our project.  We need basic help just getting the code started.  The linear actuator needs 12 volts and 1 amp, and the servos need 5-6 volts and 1 amp.  The arduino and the linear actuator are connected to the 12v battery, and the servos are connected to the 5v output of the arduino uno board.  Is this correct or do the servos need a power supply independent of the arduino?

Any basic code help or general tips would be GREATLY APPRECIATED!!!

Thanks very much, look forward to talking with you!

John
Cal Poly Mechanical Engineering
Pages: [1]