Society of Robots - Robot Forum

General Misc => Misc => Topic started by: facepwner on September 04, 2012, 01:59:18 PM

Title: Kinda problem :D
Post by: facepwner on September 04, 2012, 01:59:18 PM
Hi guys im new to this forum but i write here because i seek help. Since some time i builded my self a robot (easy one) nothing very special 2 motors servo and IR sensor for a distance and for a controller im using arduino UNO. OK got it ? Now to the problem ... when i run my first test program i saw something terrible for my eyes servo is runing the code perfectly but that is not the terrible part ;D the motors are not doing anything NOTHING not at all but when i made a program to test the motors alone (with no code for servo) they are acting well and now im STUNED please guys give me some idea to catch ;D
Title: Re: Kinda problem :D
Post by: facepwner on September 05, 2012, 01:07:39 AM
I forgot to say that im using this schematic :
(https://lh4.googleusercontent.com/-EgQK-VJRL54/TgHt3Sw1AxI/AAAAAAAAAPQ/Padivqv49YQ/s640/circuit.jpg)
and that code :
Code: [Select]
#include <Servo.h>
Servo microServo;
int motor1APin = 4;
int motor2APin = 5;
int motor1ENPin = 9;
int motor3APin = 6;
int motor4APin = 7;
int motor2ENPin = 10;
int servoPin=11;
void setup() {
pinMode(motor1APin, OUTPUT);
pinMode(motor2APin, OUTPUT);
pinMode(motor1ENPin, OUTPUT);
pinMode(motor3APin, OUTPUT);
pinMode(motor4APin, OUTPUT);
pinMode(motor2ENPin, OUTPUT);
microServo.attach(servoPin);
}
void loop() {
microServo.write(0);
analogWrite(motor1ENPin, 250);
digitalWrite(motor1APin, HIGH);
digitalWrite(motor2APin, LOW);
analogWrite(motor2ENPin, 250);
digitalWrite(motor3APin, LOW);
digitalWrite(motor4APin, HIGH);
delay(3000);
analogWrite(motor1ENPin, 0);
digitalWrite(motor1APin, LOW);
digitalWrite(motor2APin, LOW);
analogWrite(motor2ENPin, 0);
digitalWrite(motor3APin, LOW);
digitalWrite(motor4APin, LOW);
delay(2000);
microServo.write(90);
analogWrite(motor1ENPin, 250);
digitalWrite(motor1APin, LOW);
digitalWrite(motor2APin, HIGH);
analogWrite(motor2ENPin, 250);
digitalWrite(motor3APin, HIGH);
digitalWrite(motor4APin, LOW);
delay(3000);
analogWrite(motor1ENPin, 0);
digitalWrite(motor1APin, LOW);
digitalWrite(motor2APin, LOW);
analogWrite(motor2ENPin, 0);
digitalWrite(motor3APin, LOW);
digitalWrite(motor4APin, LOW);
delay(2000);
microServo.write(180);
}
Title: Re: Kinda problem :D
Post by: Soeren on September 05, 2012, 10:45:17 AM
Hi,

I forgot to say that im using this schematic :
Could you post a real schematic instead?
Title: Re: Kinda problem :D
Post by: facepwner on September 05, 2012, 12:59:37 PM
You mean a picture of the bredboard ?
Title: Re: Kinda problem :D
Post by: Soeren on September 05, 2012, 08:53:27 PM
No, a schematic, like this...
(http://that.homepage.dk/Img/LASER-LDR.png)

A picture of a breadboard (or a drawing of same), is not very helpful, as we have to "draw" a mental schematic from it, to see what's going on.

Save us from such head ache/waste of time and the quality of answers will rise exponentially :)
Title: Re: Kinda problem :D
Post by: facepwner on September 06, 2012, 04:29:13 AM
oh its a bit hard for me i have never done so hard schematic but i will try my best ... :-[
Title: Re: Kinda problem :D
Post by: Soeren on September 07, 2012, 07:50:14 PM
Hi,

You don't need to draw the Arduino - just assign the 8 wires with direction (although I guess they're all out from the arduino (to the rest of the circuiit).
Just get the pin numbers for the L293D correct as you have connected it - shouldn't be all that hard :)
Title: Re: Kinda problem :D
Post by: facepwner on September 11, 2012, 07:01:57 AM
ugh i tryed something but no idea how to do it ...  :-[
Title: Re: Kinda problem :D
Post by: facepwner on September 11, 2012, 03:15:38 PM
I think i found a clue now i saw that the individual battery for the servo isnt powering it at all and when i try to power the all parts 2 motors and servo i moves the servo only i made few tests with commands by deleting all the part of the servo and adding 1 line after every test and the motors stop runing at that line :
Code: [Select]
myServo.attach(servoPin); i think its all the powering ..