Maverick2212
New Member
Does anyone have a template for a hinge setup for a mkIII helmet, or a store that sell something that I can use?
when i push the button for the servos to turn up and for the lights to go off, that happens, and then after about 2 seconds the servos turn back down but the lights do not come on. it is basically resetting itself because i have to press the button again for the lights to come on...does anyone know what is going on and how i can fix it?
thank you but it was my battery. it was almost dead i just needed to change it, although i think the servos ARE eating up a lot of the power because one of the batteries only lasted about 2 hours when i left the thing onWhen something like that happened with my set up I think the problem was that the Servos were drawing to much power for the external batteries that I had, and that made the board reset. I think. anyway when I switched to smaller servos it worked. Maybe that is the issue that you are having?
just to integrate what myself and member "memebr" mentioned (along with his diagrams)..
a wiring diagram for my code posted.. this time including the decoupling capacitors on the LM7805 voltage regulator..
http://dmstudios.net/misc/IronMan_circuitLayout_xl97.jpg
#include <Servo.h>
//servo 1
Servo myservo;
Servo myservo1;
int val; // variable for reading the pin status
int val2; // variable for reading the delayed/debounced status
int buttonState;
int pos = 10; //<---change this next time to modify the servo arm position
int pos1 = 90; //<---change this next time to modify the servo arm position
int servostatus = 0;
int switchPin =2; // Switch connected to digital pin 2
int ledPin = 5;
void setup() // run once, when the sketch starts
{
//servo 1
myservo.attach(9);
myservo1.attach(10);
pinMode(switchPin, INPUT);
pinMode(ledPin, OUTPUT);
buttonState = digitalRead(switchPin);
myservo.write(10); //<---change this next time to modify the servo arm position
myservo1.write(90); //<---change this next time to modify the servo arm position
}
void loop() // run over and over again
//servo 1
{
val = digitalRead(switchPin); // read input value and store it in val
delay(10); // 10 milliseconds is a good amount of time
val2 = digitalRead(switchPin); // read the input again to check for bounces
if (val == val2) { // make sure we got 2 consistant readings!
if (val != buttonState) { // the button state has changed!
if (val == LOW) { // check if the button is pressed
if (servostatus == 0) { // is the light off?
servostatus = 1; // turn light on!
myservo.write(10); //<---change this next time to modify the servo arm position
myservo1.write(90); //<---change this next time to modify the servo arm position
delay(1000);
digitalWrite(ledPin, HIGH);
delay(50);
digitalWrite(ledPin, LOW);
delay(00);
digitalWrite(ledPin, HIGH);
delay(50);
digitalWrite(ledPin, LOW);
delay(00);
// fading
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) {
// sets the value (range from 0 to 255):
analogWrite(ledPin, fadeValue);
delay(30);
}
} else {
servostatus = 0; // turn light off!
digitalWrite(ledPin, LOW);
delay(15);
myservo.write(90); //<---change this next time to modify the servo arm position
myservo1.write(10); //<---change this next time to modify the servo arm position
}
}
}
buttonState = val; // save the new state in our variable
}
}
i did have the same problem, maybe you should try to change the switch. for me i change to 2 legs and it work