Hey guys I am in desperate need of some help. I wrote a small program that will use the outputs of an RC module as inputs that control the direction of a motor. I made it so that the arduino should read digital values as inputs, then write digital values out to a relay circuit which drives the motor. I am measuring the voltage being outputted by output “motor” pins and it only gives me a 0.001 volt instead of five volts. Any suggestions?
/// Start of program
//Switches
int topswitch = 2;
int topswitchout = 3;
int bottomswitch = 5;
int bottomswitchout = 6;
//Control input
int upinput = 7;
int downinput = 8;
//Motor Output
int motorup = 9;
int motordown = 10;
// The setup() method runs once, when the sketch starts
void setup() {
// initialize the digital pin as an output:
pinMode(topswitch, INPUT);
pinMode(topswitchout, OUTPUT);
pinMode(bottomswitch, INPUT);
pinMode(bottomswitchout, OUTPUT);
pinMode(upinput, INPUT);
pinMode(downinput, INPUT);
pinMode(motorup, OUTPUT);
pinMode(motordown, OUTPUT);
}
// the loop() method runs over and over again,
// as long as the Arduino has power
void loop()
{
digitalWrite(topswitchout, HIGH);
digitalWrite(bottomswitch, HIGH);
//Motorstop control
if (topswitch == HIGH)
{
digitalWrite(motorup, LOW);
}
if (bottomswitch == HIGH)
{
digitalWrite(motordown, LOW);
}
//MotorControl
if (upinput == HIGH)
{
digitalWrite(motorup, HIGH);
}
else
{
digitalWrite(motorup, LOW);
}
if (downinput == HIGH)
{
digitalWrite(motordown, HIGH);
}
else
{
digitalWrite(motordown, LOW);
}
}