I got the program up loaded. I have tried to use the little code that Kurt wrote and, the code has a undefined if the code looks right but it wont upload to the board any thing missing that I’m not seeing. also is there a way to see if my controller works that way i can use a servo to see if it taking to each other.
Thanks to all that help me the program works like a charm. jest got a pan and tilt and a led spot light and would like to know how to use the L1 for on and L2 for off on the spot light and and use the d pad for the up down and left and right on the pan and tilt. this is the last thing i’m doing for now till i get my new wheels or tracks. Not to sure on whether to use wheels or tracks or both? :mrgreen:
What kind of light are you thinking of controlling? The BotBoarduino will not be able to drive a lamp directly… To control something that draws a lot of amperage you will need to power it direct from the battery or even from a separate battery. To control the state of the lamp you will probably need to use some kind of relay or opto-isolator…
I have a pico switch to control the spot light. I would like to have a code that will us the left stick for driving and the, D pad for the pan and tilt L1 for the led start for on and off for the robot. Then use select for turning the cam on and off. The R1 for a on off command and triangle for the lazer, But i don’t know how to wright codes for the robot can. Someone write me a code and then enplane it to me on how to set up the code. Sorry to sound new but the book that i have doesn’t say how to wright codes using ps2 controllers jest how to make led blink and turn stuff on and off? If some one would help me i will start a new topic so that me learning will help those that are new to this as well? this would be a hot topic and would be the most useful for the newbie that don’t what to ask and look bad for asking like i do.
I spoke to soon i was toying around and reading the code and, trying it on my spare board and opened the monitor and it was throwing a error 3 and the, led that i had on pin 2 stays lit and dims when i move the stick up and down. do i have something wrong?
Error 3 simply means your controller doesn’t support analog button presses. This will have no effect on this program. The LED on pin two is lighting up based on the PWM pulses being sent to the motor controllers…
so it should be on at all times and only dim when i move the stick?
You really shouldn’t have an LED on that pin as it will weaken the signal to the motor controllers…
Its jest to test the code and see if my controller is working can u read my post before that and see if that’s a good idea? So it would help me and other people understand what we use to wright a code using the ps2 controller. There is no were on the web that i have seen that tells us how to wright codes with a ps2 and convert the signals form the controller to commands such as if i hit L1 then the pico switch that’s on pin 5 will light hit again and it will turn off.
OK can someone jest give me a list of commands for using the ps2 controller and, a example on how to start the code i think I’m starting to under stand how to under stand. i have not found any outline on how to write a sketch for the arduino i see a lout of codes for bs2 but i could use so help in understanding how to wright a code so that i can use the controller and board. or should i jest send it back? I’m at wits in. Help so i dont lose to a robot.
Devon tried to help you out of pure niceness. We generally do not write code for people on the forum… You will get better results being nice, than being rude.
You need to try reading through the Reference and Learning sections of the Arduino home page. The only reason you have not found any example is simply because you are not even trying to look.
Also, I told you before… There’s a great example on the different functions in the PS2X library. In the Arduino IDE you’ll find it under:
File > Examples > PS2X > Examples
Sorry for being rude it was my fault i downloaded the wrong lib. I downloaded the lib v 1.6 and not the v 1.0 like the board i read the bill poter page and downloaded the wrong one.
I was able to get the PS2 working on a Bot boarduino with the help of this board. read throuh this thread
Thanks that helps me a lot is it the same layout for v1.0 ?
if(ps2x.Button(PSB_GREEN)) { //will be TRUE if button was JUST pressed OR released
Serial.println(“Triangle pressed BANG!”);
digitalWrite(GunSW, HIGH);
delay(1000);
digitalWrite(GunSW, LOW);
is this how u aside the button to out put for all bottoms. IF so do u have a example on how to use the analog sticks?
Sorry I only tested it on Version 1.6. I see its been updated to Version 1.8
If I recall in the Library download the example shows how to read the anolog X and Y values
I believe the example code has examples of using the analog inputs as well. For example this section:
if(ps2x.Button(PSB_L1) || ps2x.Button(PSB_R1)) // print stick values if either is TRUE
{
Serial.print("Stick Values:");
Serial.print(ps2x.Analog(PSS_LY), DEC); //Left stick, Y axis. Other options: LX, RY, RX
Serial.print(",");
Serial.print(ps2x.Analog(PSS_LX), DEC);
Serial.print(",");
Serial.print(ps2x.Analog(PSS_RY), DEC);
Serial.print(",");
Serial.println(ps2x.Analog(PSS_RX), DEC);
}
I cant find a link to the update is it on arduinos website or some other web site? Also should i update to the 1.8 or would it hurt to stay with the v1.0?
This the link to Bill Porter’s webpage and if you scroll down you’ll see Download PS2X thats the down load link to the latest version. As for which version to use thats up to you.
OK i have looked at the code that l see in the exampel for v1.0 . So far i under stand that IF is were we read the botton and tell it to serial. print that its been pushed
if(ps2x.ButtonPressed(GREEN_FRET))
Serial.println("Green Fret Pressed");
so for me to use it to lets say turn the led on pin 13 on. i would wirte in digtal write(led,high); do ihave this right so far? or did i go way off on my understanding?