Pages: 1 [2]   Go Down
Author Topic: (Solved)Arduino Uno only 1.5 volts from digital outputs instead of 5 volts  (Read 4570 times)
0 Members and 1 Guest are viewing this topic.
Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 626
Posts: 34143
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
probably signify its a problem with the sketch one would assume?
Yes as mentioned at the start you are probably not setting them to outputs or they are being reset to inputs somewhere else in the sketch.
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 57
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i may have discovered what is wrong but i am not positive on this, i believe the stop command being at the end of every if statement is conflicting with the outputs. everything is set to "else" stop so when one, lets say "left" command, is trying to give power to one of the motor and speed pins, all the other if statement commands are trying to tell those pins to "stop" or write time "low". someone please correct me if i am wrong and if i am right i would appreciate help with a way around this problem in my sketch
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 485
Posts: 18771
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Almost certainly. First how about doing what a number of people suggested?

Please edit your post, select the code, and put it between [code] ... [/code] tags.

You can do that by hitting the # button above the posting area.


What you are measuring as 1.5 V with a multimeter is quite likely to be 5V, pulsed with 0V, at a certain rate. An oscilloscope or logic analyzer would clear that up.
Logged


Offline Offline
Jr. Member
**
Karma: 0
Posts: 57
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i devised a new code that is operational and seems to have solved my problem but does not give me dependable simultaneous operation of both motors but it shall do..... i thank you all for your input on this matter. here is a copy of my redone code

Code:
int pinI1=8;//define I1 interface
int pinI2=11;//define I2 interface
int speedpinA=9;//enable motor A
int pinI3=12;//define I3 interface
int pinI4=13;//define I4 interface
int speedpinB=10;//enable motor B

int rcleft=2;  //rc reciever inputs which are just basic
int rcright=3;  // 5 volt on off buttons so to speak because
int rcforward=4; // my reciever is not pwm
int rcbackward=5;

void setup()
{
  pinMode(pinI1,OUTPUT);
  pinMode(pinI2,OUTPUT);
  pinMode(speedpinA,OUTPUT);
  pinMode(pinI3,OUTPUT);
  pinMode(pinI4,OUTPUT);
  pinMode(speedpinB,OUTPUT);
  pinMode(rcleft,INPUT);
  pinMode(rcright,INPUT);
  pinMode(rcforward,INPUT);
  pinMode(rcbackward,INPUT);
}
 
void forward() //one could use analogWrite to slow the speed of the
{             // motors but if you wanted to adjust the speed
             // you would have to reupload the sketch
     digitalWrite(speedpinB,HIGH);
     digitalWrite(pinI4,HIGH);//turn DC Motor B move clockwise
     digitalWrite(pinI3,LOW);
}
void backward()
{
     
     digitalWrite(speedpinB,HIGH);
     digitalWrite(pinI4,LOW);//turn DC Motor B move anticlockwise
     digitalWrite(pinI3,HIGH);
     
}
void left()
{
     digitalWrite(speedpinA,HIGH);
     digitalWrite(pinI2,HIGH);//turn DC Motor A move clockwise
     digitalWrite(pinI1,LOW);
}
void right()
{
     digitalWrite(speedpinA,HIGH);
     digitalWrite(pinI2,LOW);//turn DC Motor A move clockwise
     digitalWrite(pinI1,HIGH);
}
void stop()
{
     digitalWrite(speedpinA,LOW);// Unenble the pin, to stop the motor. this should be done to avid damaging the motor.
     digitalWrite(speedpinB,LOW);
     digitalWrite(pinI1, LOW);
     digitalWrite(pinI2, LOW);
     digitalWrite(pinI3, LOW);
     digitalWrite(pinI4, LOW);
     
 
}

void loop() {
  if (digitalRead(rcleft) == HIGH) {
    left();
  }
 
  else if (digitalRead(rcright) == HIGH) {
    right();
  }
 
  else if (digitalRead(rcforward) == HIGH) {
    forward();
  }
 
  else if (digitalRead(rcbackward) == HIGH) {
    backward();
  } else {
    stop();
  }
}
   
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17294
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Cool. So lesson learned?

It's hard to debug a software problem with a voltmeter.
But then again it's also pretty hard to troubleshoot a wiring problem with a software debug function.  smiley-wink

Welcome to the embedded controller world where hardware is king and software is always evil.  smiley-grin


Lefty
Logged

Pages: 1 [2]   Go Up
Jump to: