hello,i have made the Walsh3d mk39 helmet,and (although the code wouldn't properly work for me),i used the crashworks3d circuit layout (https://github.com/crashworks3d/Iron_Man_Servo/blob/v3.0.1.2/images/wiring_diagram_1.jpg). However,my problem is that the servos will properly move down/close the faceplate, but (although theres no audio) the servos make aa noise as though theyre moving,but will barely move up,if they do at all,does anyone know how to fix it/what the problem is? im unable to take a screenshot or make a link for my code,so ill add it in the comments
#servo problem
5 messages · Page 1 of 1 (latest)
Hey @alpine dock, thank you for contributing to this forum.
Please provide as much information (images, video, description) as you can. This will increase the chance that someone can help you with your issue.
Use the Close button when your issue is resolved.
#include <Servo.h>
Servo servo1;
Servo servo2;
const int limitSwitchPin = 2;
const int ledPin1 = 6; // First LED eye
const int ledPin2 = 7; // Second LED eye
const int servo1Pin = 9;
const int servo2Pin = 10;
int servo1ActivePos = 180; // Set your desired active position for servo1
int servo1InactivePos = 45; // Set your desired inactive position for servo1
int servo2ActivePos = -180; // Set your desired active position for servo2
int servo2InactivePos = -45; // Set your desired inactive position for servo2
bool isActive = false;
void setup() {
pinMode(limitSwitchPin, INPUT_PULLUP);
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
servo1.attach(servo1Pin);
servo2.attach(servo2Pin);
servo1.write(servo1InactivePos);
servo2.write(servo2InactivePos);
digitalWrite(ledPin1, LOW);
digitalWrite(ledPin2, LOW);
}
void loop() {
if (digitalRead(limitSwitchPin) == LOW) {
delay(50); // Debounce delay
if (digitalRead(limitSwitchPin) == LOW) {
isActive = !isActive;
if (isActive) {
activateHelmet();
} else {
deactivateHelmet();
}
while (digitalRead(limitSwitchPin) == LOW); // Wait for button release
}
}
}
void activateHelmet() {
for (int pos = servo1InactivePos; pos <= servo1ActivePos; pos++) {
servo1.write(pos);
servo2.write(pos);
int brightness = map(pos, servo1InactivePos, servo1ActivePos, 0, 255);
analogWrite(ledPin1, brightness);
analogWrite(ledPin2, brightness);
delay(15); // Adjust delay for smooth movement
}
}
void deactivateHelmet() {
for (int pos = servo1ActivePos; pos >= servo1InactivePos; pos--) {
servo1.write(pos);
servo2.write(pos);
delay(15); // Adjust delay for smooth movement
}
digitalWrite(ledPin1, LOW);
digitalWrite(ledPin2, LOW);
}
this is my code
use crashworks 3d code 100 times better https://github.com/crashworks3d/Iron_Man_Servo
I did try that originally,however the faceplate wouldn't close or open,I even bought the servos and such from Frank's video link,but they didnt work,I'll try it again and let you know if it works