Show Posts
Pages: [1] 2 3 ... 6
1  Using Arduino / Project Guidance / Re: Arduino Robot Lag on: October 15, 2013, 11:41:34 am
i delete that LedBlink and the problem is the same can it be that to voltage on Enable pins are to low, 
should i use a pnp transistor to improve that and if i do that how much will it be beter
2  Using Arduino / Project Guidance / Arduino Robot Lag on: October 14, 2013, 01:11:31 pm
Hey every one today i finish building my robot, and have trouble with the time delay
simply putting i have a output lag it when i press a button on ps3 its take some time for
the arduino to process it  to the output pine
hers my code  
the lib core
and when im outline this section or let 2 of them its run smooth without lag
 
Code:
{
//LedBlink();
MotorOnePWM();
//MotorTwoA();
//MotorTwoB();
//MotorThreeA();
//MotorThreeB();
MotorFourA();
}
so im assuming that im doing something wrong
so can some one advice in this mater
3  Using Arduino / Programming Questions / Re: wrong PWM output value on: October 05, 2013, 02:26:35 pm
hey again i test my Mega PWM output voltage today and the val was 4,7 - 4,5
here the code  its simple but was enough
Code:
int ledPin1 = 9;    // LED connected to digital pin 9
int ledPin2 = 3;
int fadeValue = 0;

void setup()  {
// nothing happens in setup
Serial.begin(115200);
Serial.println("RDY");
}

void loop()  {
// fade in from min to max in increments of 5 points:
for(fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) {
// sets the value (range from 0 to 255):
Serial.print("+ ");
analogWrite(ledPin1, fadeValue);
analogWrite(ledPin2, fadeValue);
Serial.println(fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(100);
}

// fade out from max to min in increments of 5 points:
for(fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) {
// sets the value (range from 0 to 255):
Serial.print("- ");
analogWrite(ledPin1, fadeValue);
analogWrite(ledPin2, fadeValue);
Serial.println(fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(100);
}
}
so im assuming that the power difference now have something to do with arduino usb shild, can some one tell my witch pins use this shild?
4  Using Arduino / Programming Questions / Re: wrong PWM output value on: October 04, 2013, 03:20:51 am
i try that but the problem is the same im going to write a simple code to control my hbridge without any lib and will see if the problem still occurs
5  Using Arduino / Programming Questions / Re: wrong PWM output value on: October 03, 2013, 12:28:22 pm
im using a L298N hbridge i try different pins but the problem is the same i try with 7,2v battery pack but stile the same

this is a screen of my problem
voltage pin1 is corresponding with enable A
voltage pin2 is corresponding with enable B
the output voltage drops to 50% on that pin

i found my old project using the old fashion whey but i have the same problem but my output voltage thats enabling A drops to 75% so im starting assuming that this have something to do with this usb shild

dose any one now witch pins are reserved for the use of arduino USB shild?
6  Using Arduino / Programming Questions / Re: wrong PWM output value on: October 03, 2013, 06:28:54 am
how about a github link https://github.com/THXC/Arduino/tree/master/libraries/HBridge
7  Using Arduino / Programming Questions / Re: wrong PWM output value on: October 03, 2013, 06:08:46 am
lib core
 https://www.dropbox.com/sh/aw6r69lxba09f4j/mG65VeVSpr
https://github.com/THXC/Arduino/tree/master/libraries/HBridge

Quote
Quote
if ((PS3.getAnalogButton(L2))&&!(PS3.getAnalogButton(R2))&&!(PS3.getButtonPress(CROSS)))
Isyourspacebarbroken?
YES:D
Quote
Quote
im mapping one val
What val(ue)?
PS3.getAnalogButton(L2) its analog val in range from 0-255
Quote
Quote
to 2 output pins
Which 2 pins?
this hb1.setEnablePins(2,3);  firs is for EN A and second is for ENB
Quote
Quote
and my first define pin
I don't see any #define statements, so this makes no sense.
the #define pins are in .setEnablePins is for enable A or B and/or to set the  PWM
the #define pins are in .setControlPins is for the enable inputs to control the rotary direction
8  Using Arduino / Programming Questions / Re: wrong PWM output value on: October 03, 2013, 05:13:14 am
sry for that here the code
Code:
#include <PS3BT.h>
#include <HBridge.h>
#include <usbhub.h>

USB Usb;
USBHub Hubl(&Usb);
BTD Btd(&Usb);
PS3BT PS3(&Btd,0x00, 0x09, 0xDD, 0x50, 0x8F,0xC6);

HBridge hb1(1); //
HBridge hb2(2); //
HBridge hb3(3); //
HBridge hb4(4); //

void setup()
{
Serial.begin(115200);
Usb.Init();
if (Usb.Init() == -1)
{
Serial.print(F("\r\nOSC did not start"));
while(1); //halt
}
Serial.print(F("\r\nPS3 Bluetooth Library Started"));

hb1.setEnablePins(2,3);
hb2.setEnablePins(50,29);
hb3.setEnablePins(31,41);
hb4.setEnablePins(53,43);

hb1.setControlPins(42,44,46,48);
hb2.setControlPins(52,23,25,27);
hb3.setControlPins(33,35,37,39);
hb4.setControlPins(45,47,49,51);
}

void loop()
{
/*THE MANIN PROGRAM*/
Usb.Task();
if(PS3.PS3Connected)
{
//LedBlink();
MotorOnePWM();
}
}

/*Motor PWM*/
void MotorOnePWM()
{
//Go Backward With L2
if ((PS3.getAnalogButton(L2))&&!(PS3.getAnalogButton(R2))&&!(PS3.getButtonPress(CROSS)))
{
hb1.PWM(PS3.getAnalogButton(L2));
hb1.movePWMBackward();
}

//Go Forward With R2
if ((PS3.getAnalogButton(R2))&&!(PS3.getAnalogButton(L2))&&!(PS3.getButtonPress(CROSS)))
{
hb1.PWM(PS3.getAnalogButton(R2));
hb1.movePWMForward();
}

//Rotate Conterclockwise L2+X
if ((PS3.getAnalogButton(L2))&&!(PS3.getAnalogButton(R2))&&(PS3.getButtonPress(CROSS)))
{
hb1.PWM(PS3.getAnalogButton(L2));
hb1.PWMturnLeft();
}

//Rotate Clockwise R2+X
if ((PS3.getAnalogButton(R2))&&!(PS3.getAnalogButton(L2))&&(PS3.getButtonPress(CROSS)))
{
hb1.PWM(PS3.getAnalogButton(R2));
hb1.PWMturnRight();
}

//Motor OFF
hb1.Stop();
}

/*Led Blink if connected to controller*/
void LedBlink()
{
digitalWrite(22, HIGH);
delay(350);
digitalWrite(22, LOW);
delay(350);
}
9  Using Arduino / Programming Questions / Re: wrong PWM output value on: October 03, 2013, 04:20:35 am
im mapping one val to 2 output pins and my first define pin is all ways in range of 0 - 2,2v
im receiving this val from an PS3 controller and on the serial print i have val from 0 to 255 so this can be the cause or maybe im wrong?
10  Using Arduino / Programming Questions / Re: wrong PWM output value on: October 03, 2013, 03:07:13 am
im using MEGA 2560 with an usb shield connected to a BT stick and im receiving an analog val in range 0 -255 and this mapping is simple, the PWM output is to control speed of my H-Bridges but like i mention the output voltage for first (define) pin is in range from 0- 2,2V and the second is from 0 to 4,4 4,5V
can it be that arduino cant write 2 same val at the same time ?
11  Using Arduino / Programming Questions / wrong PWM output value on: October 01, 2013, 01:44:16 pm
hey guys have an annoying problemm with my code
Quote
int val = A0
analogWrite(2, val);
analogWrite(3, val);
this code its a bit simple but you now what i mean i mapping my input val and im sending it as my output val to pin 2 and pin 3
on this setup my voltage on pin 2 is half so high as my pin 3 voltage ( pin 2 voltage 2,20 and pin 3 voltage ~ 4,3 4,5)
if i change the output order to this
Quote
int val = A0
analogWrite(3, val);
analogWrite(2, val);
my val on pin 3 its half so high as my pin 2 voltage
normal i would don't mine but im controlling 2 DC motor with this, did some one have this same problem or im i doing something wrong?
12  Using Arduino / Programming Questions / Re: communication between 2 arduino boards on: August 25, 2013, 07:09:51 am
sry i forgot
MEGA
Code:
void setup()
{
Serial.begin(115200);
Serial.print("RDY");
Serial1.begin(115200);
}

void loop()
{
if(Serial1.available()>0)
{
Serial.print("Val ");
int val = Serial1.parseInt();
Serial.println(val);
}
}
UNO
Code:
void setup()
{
Serial.begin(115200);
}

void loop()
{
VAL();
}

void VAL()
{
int val = analogRead(A1);
Serial.println(val);
}
13  Using Arduino / Programming Questions / Re: communication between 2 arduino boards on: August 22, 2013, 06:41:36 am
Quote
... if you choose the two byte solution, you need something to synchronise what is the 1st and 2nd byte. You can rely on that if you reset both machines, or only reset when there is an idle situation, so that they can remain "in step" of the protocol.

Remember that Serial.read() also only returns a single byte.

It may work fine - but if it goes awry you now know of a possible hazard.

A toally differnet one is to use Serial.println(value); which will transmit the value as several ASCII characters including a terminating NewLine. This can be parsed on the receiving side with the Serial1.parseInt(). This way you can transfer intergers and(almost) not worry. (there is a potential blocking state where it waits for the terminating character.... ah, it's never simple  smiley-sad )
did like u seed im sending from UNO a val that's equal to 900 but on MEGA i receive something like this
Code:
Val 1
Val 901
Val 901
Val 1
Val 901
Val 901
Val 901
Val 901
Val 901
Val 901
Val 901
Val 1
Val 24565
Val 901
Val 1
Val 9001
Val 9011
Val 24565
Val 25365
Val 9
Val 901
Val 901
Val 1
Val 24565
Val 901
Val 902
Val 901
Val 9901
Val 9901
Val 9001
Val 9011
Val 901
Val 901
Val 1
Val 901
Val 9901
Val 901
Val 901
Val 1
Val 9011
Val 9011
Val 9011
Val 9011
Val 24565
Val -32061
Quote
analogRead returns an int, not a byte, so you are truncating the 2 most significant bits of the 10 bits that analogRead() returns. If you want the full 10-bit precision of the analog read you need to send both the highByte() and the lowByte() of the int that analog read returns, and reconstruct the int using addition and shifting on the receiver end. If you only need 8-bits of precision, then right shift the int returned by analogRead() by two before sending it. The result will be a value between 0 and 255 that is mapped to the 0 to 1023 range.
did that but on UNO my val is between 0-1023 and on MEGA is something like this (0-255) and this four times basically
Code:
UNO => MEGA
0 = 0
128 = 255
129 = 0
256 = 255
257 = 0
512 = 255
513 = 0
1023 = 255
14  Using Arduino / Programming Questions / communication between 2 arduino boards on: August 21, 2013, 01:53:49 pm
Hey guys have a simple problem between communication
i want to send a val between 2 board, UNO is TX and MEGA is RX but the val i get on Mega is four times smaller than the original val from UNO
UNO
Code:
void setup()
{
Serial.begin(115200);
}

void loop()
{
VAL();
}

void VAL()
{
byte val = analogRead(A1);
Serial.write(val);
}
MEGA
Code:
void setup()
{
Serial.begin(115200);
Serial.print("RDY");
Serial1.begin(115200);
}

void loop()
{
if(Serial1.available()>0)
{
Serial.print("Val ");
int val = Serial1.read();
Serial.print(val);
}
}
15  Using Arduino / Motors, Mechanics, and Power / library to use a I2C to control a H-Bridge on: August 19, 2013, 07:54:02 am
Hey guys i have done a lib and want to sheer it with u
this lib allows u to control a H-Bridge using a I2C controller
https://github.com/THXC/Arduino/tree/master/libraries/HBridgeI2C
i hope that u will have fun using this lib
Pages: [1] 2 3 ... 6