I am in the process of making a full stage lighting system. it will include 2 homemade moving head lights.(4 servos+2 Lights) 12 on/off lights.(12 relays) 1 homemade "Moonflower" like light (16 leds+2 shift registers) one color changing light(RGB Leds) 2 laser spiro-graphs(6 dc motors 2 lasers).
i am trying to make a control board using the Arduino mega, i want to use a 4-wire resistive touch screen, some slider pots, some rotary pots, and some push buttons.
the outher day i connected 4 slide pots to the arduino and 4 servos, it worked fine for a minute then all of a sudden the servos went crazy and there pots didnt do anything.
this is the code i am using.
#include <Servo.h>
//servos
Servo MS1;
Servo MS2;
Servo MS3;
Servo MS4;
//pots
int PP1 = 0;
int PP2 = 1;
int PP3 = 4;
int PP4 = 5;
int PP5 = 6;
//Vals
int V1;
int V2;
int V3;
int V4;
int V5;
void setup()
{
MS1.attach(2);
MS2.attach(3);
MS3.attach(4);
MS4.attach(5);
}
void loop()
{
V1 = analogRead(PP1); // reads the value of the potentiometer (value between 0 and 1023)
V1 = map(V1, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180)
MS3.write(V1); // sets the servo position according to the scaled value
V2 = analogRead(PP2); // reads the value of the potentiometer (value between 0 and 1023)
V2 = map(V2, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180)
MS4.write(V2);
V3 = analogRead(PP3); // reads the value of the potentiometer (value between 0 and 1023)
V3 = map(V3, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180)
MS3.write(V3); // sets the servo position according to the scaled value
V4 = analogRead(PP4); // reads the value of the potentiometer (value between 0 and 1023)
V4 = map(V4, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180)
MS4.write(V4);
}
any help would be appreciated