problem I see... is people taking this FREE info (where we have done all the work).. and FREE CODE.. and then go to offer kits or things THEY profit from..
This code is working ok. Its hard to say, your problem can be (i think):
1. damaged servo (or wrong degrees setup)
2. Broken button (or wrong button install)
3. Mistake in your montage. have take a look one more time. Good luck!
p.s. by the way - first button push - it must leds blink and ON. so - you have no leds, but code doesnt know it.![]()
Just checked, everything is ok, but im still having the same problem
Sent from my HTC One X+ using Tapatalk 2
you could probably use 1 LM7805 regulator..
the problem MIGHT be (again Im as new as everyone else here)... that the LM7805 (I think) only lets in around 800mA constant current?
depending on the LOAD we're only guessing at the real current needs/draw from the servos..
thinking..
batery to +5v regulator..
going to/through a transistor before going to the LEDS will have a small/slight voltage drop.. (probably under 0.7)
so calculate the resistor value used for the leds based off +5v - trans drop value..
here is a my quick wiring diagram from the other day:
make note of:
1.) this is for MY code
2.) double, triple check the transistor you use and get the pinout correct
3.) calculate resistor values based on the actual parts/battery..etc used IN THE PROJECT
http://dmstudios.net/misc/IM_eyeCircuit/IronMan_circuitLayout_xl97.jpg
as memebr says.. the Arduino (in this case) is nothing more than a smart button.... it POWERS/DRIVES nothings..
if you look at the IM led eye circuits boards I made.. you will see the leds, resistors and transistor are all one board/piece..
there are some solder pads on it, for the battery +/- pack.. but also a pad for the Arduino control/signal line..
the only real contact/connection with the Arduino..![]()
do you have any arms or load on the servos?
what servos are they? more so.. what are they rated for? are you powering them enough/correctly?
some are 4.8-6.0+ voltage...
and the current they use under load can be over 1 amp spikes..
still sounds like the GNDS arent all tied together though..
Everything is ok, the servos works, also the lights with a little adjust, now i am going to make a PCB to make this circuit as compact as possible. For now i will install the cervos on my WM MK II helmet. Wish me luck
This different code will make the LED flicker then fade on, one second after the faceplate closes. Mimicking a powering up function. Demonstration here. Thank you to guitarkizta for this code:
#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 = 0;
int pos1 = 180;
int servostatus = 0;
int switchPin =2; // Switch connected to digital pin 2
int ledPin = 5;
int ledPin2 = 18;
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(0);
myservo1.write(175);
pinMode(ledPin2, OUTPUT);
}
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(0);
myservo1.write(180);
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);
digitalWrite(ledPin2, LOW);
myservo.write(180);
myservo1.write(0);
}
}
}
buttonState = val; // save the new state in our variable
}
}
Please tell me this isn't happening!!!!
That SUCKS!!!!