Shop OBEX P1 Docs P2 Docs Learn Events
Gimble Joy stick issues — Parallax Forums

Gimble Joy stick issues

plau45plau45 Posts: 109
edited 2014-07-19 11:12 in Learn with BlocklyProp
I bought a gimble joystick and hooked it up to see if I could run a servo off of it but I go to the code and put the gimble together and wire it correctly but when I hook up a servo to any servo slot and try the Gimble it does not work. If some one could tell me hat is wrong that would be nice. And yes the power is on.

Comments

  • kwinnkwinn Posts: 8,697
    edited 2014-07-17 19:26
    The Parallax gimbal joystick or some other one? What servo? What microcontroller, and what code?

    You need to post some more information and a wiring diagram.
  • NWCCTVNWCCTV Posts: 3,629
    edited 2014-07-17 20:52
    plau45, Welcome to the Forums. As kwinn said, we need to know which Joystick Gimbal, MCU and Servo you are referring to, post a link if possible. Post your code and be sure to use the code brackets. A schematic would not hurt either. This will help others help you much quicker.
  • plau45plau45 Posts: 109
    edited 2014-07-18 13:36
    Ok
    thanks. I'm new to this so I
    will try my best.
  • plau45plau45 Posts: 109
    edited 2014-07-18 13:57
    Heres the joystick I'm using. http://www.parallax.com/product/27808
    Gimbal Joystick with Adapter Product Guide
    I FoollOWS GUE and used the simpleide version and am using the micro servo from radioshack. There were no other specifications with it about the model.
  • PublisonPublison Posts: 12,366
    edited 2014-07-18 14:08
    plau45 wrote: »
    Heres the joystick I'm using. http://www.parallax.com/product/27808
    Gimbal Joystick with Adapter Product Guide
    I FoollOWS GUE and used the simpleide version and am using the micro servo from radioshack. There were no other specifications with it about the model.

    I'm no familiar with the C code yet, although I have used the Spin Code with the Board of Education, and it works correctley.

    Do you have a picture of your setup?

    What is the hardware you are connecting to?
  • Duane DegnDuane Degn Posts: 10,588
    edited 2014-07-18 14:11
    plau45 wrote: »
    Heres the joystick I'm using. http://www.parallax.com/product/27808
    Gimbal Joystick with Adapter Product Guide
    I FoollOWS GUE and used the simpleide version and am using the micro servo from radioshack. There were no other specifications with it about the model.

    That's very helpful. I doubt we need more information about the servo but which board are you using? Is this the Activity Board?

    Besides the hardware, we also need to know what software (the program) you're using.

    If the programs are from the Learn site, a link would help. If it's your own program you can enter into the forum by typing [noparse]
    at the beginning of your code and
    
    [/noparse] at the end to maintain the indentations.

    Edit: I see Publison beat me to it. FYI, the ADC on the PropBOE and the ADC on the Activity Board are different chips and use different I/O pins. The code isn't interchangeable between the two.
  • plau45plau45 Posts: 109
    edited 2014-07-18 17:22
    I placed attachments of what the setup is.
    I'm using the activity board. And I'm connected to my computer through a USB port.
    1024 x 576 - 52K
    1024 x 576 - 55K
    1024 x 576 - 56K
    1024 x 576 - 85K
    1024 x 576 - 85K
  • NWCCTVNWCCTV Posts: 3,629
    edited 2014-07-18 18:12
    Can you post your code using the code brackets? A picture of your code is really difficult to see.
  • NWCCTVNWCCTV Posts: 3,629
    edited 2014-07-18 18:23
    I believe that code is for displaying voltages only and is intended as Demo code. It does not appear that there is code for controlling a servo in which case you will need to write your own. If you have gone through the SimpleIDE Learn Tutorials it should be pretty easy to figure out. You will need to use the
    # include servo.h
    
    directive. Below is some simple Servo testing code that should get you started:
    #include "simpletools.h" // Include simpletools header#include "servo.h" // Include servo header
    
    
    int main() // main function
    {
    servo_angle(16, 0); // P16 servo to 0 degrees
    pause(3000); // ...for 3 seconds
    servo_angle(16, 900); // P16 servo to 90 degrees
    pause(3000); // ...for 3 seconds
    servo_angle(16, 1800); // P16 servo to 180 degrees
    pause(3000); // ...for 3 seconds
    servo_stop(); // Stop servo process
    }
    
  • plau45plau45 Posts: 109
    edited 2014-07-18 18:32
    I will attach the file to the post. Open it up with SimpleIDE.
  • plau45plau45 Posts: 109
    edited 2014-07-18 18:34
    I didn't think that the code was for the Joystick. It was just a regular code you put into the device and tested by clicking run terminal.
  • plau45plau45 Posts: 109
    edited 2014-07-18 18:40
    Ok now I understand where I went wrong thank you. If you have any tips for how to learn about writing the code quickly than that would be awesome. Thank you.
  • NWCCTVNWCCTV Posts: 3,629
    edited 2014-07-18 19:01
    The code I posted in post #10 is SimpleIDE code for testing a servo on pin 16. That should get you started. I do not have one of those Joysticks so that is what I can help with for now. If I have time I will research a little further to see if I can be of more help. In the mean time, just play around and see what you can do and come back for more help. I know there are others that are tons smarter than I am that will chime in here to help out more but it's a start.
    I didn't think that the code was for the Joystick.
    Yes, it is for the Joystick. The values change as you move the Joystick. That basically tells you it is working.
  • plau45plau45 Posts: 109
    edited 2014-07-18 19:41
    Thank you and th joy stick works for one axis but not for the other.
  • plau45plau45 Posts: 109
    edited 2014-07-18 21:01
    If any body reading this has code for a joystick to control a servo than please post it on this thread for me thank you.
  • NWCCTVNWCCTV Posts: 3,629
    edited 2014-07-18 22:38
    Are you certain it is wired correctly. First things first. You need to make sure it is working correctly for all aspects. Once you are certain that the joystick is working correctly then move on. While you are waiting to see if anyone else has code it might be a good idea to give it a go and see what you can come up with. I have some different types of joysticks and if I have time over the weekend will see if I can get one working with a servo. It would not be exactly the same but close enough to get you started.

    EDIT: Also, Be patient. Most people on the Forum have full time day and or night jobs. This has to be one of the most helpful Forums I have ever been a member of.
  • plau45plau45 Posts: 109
    edited 2014-07-19 09:44
    Yeah I am trying and I copied the diagram exactly it showed.
  • PublisonPublison Posts: 12,366
    edited 2014-07-19 09:56
    plau45 wrote: »
    Yeah I am trying and I copied the diagram exactly it showed.

    Make sure The C code for the Joystick works for both axis before proceeding. You said you only get one axis.

    There has been no code that I know of the incorporates the joystick reading to a servo output.

    Here is from the Learn Site
    Your Turn

    You may want to drive a servo with your joystick. Perhaps you want your servo to start at 90 degrees and move ±60 degrees from there. Write some code to do this scaling, and output the result for each axis on the terminal.
    • This is a simple application of y=mx + b. In the example above, m was 40 and b was -2.5/40. See if you can figure out the new equation for the servo application.
    • Try changing the program in Try This to display 0 to 100% instead of -100 to 100.
    Hint: to display the “%” character in the serial terminal, we need to type two of them in the printcommand. This is because % acts as a special operator in print commands so it is necessary to have two % characters tell print to display a literal “%.”

    I believe Spin code is available but I can not locate it at this time.
  • plau45plau45 Posts: 109
    edited 2014-07-19 11:12
    Ok thanks. I am still not all the way through the tutorials. Thanks guys.
  • If you are still watching this thread, what the documentation fails to show in the breadboard circuit is, wiring the other side of each potentiometer.
    640 x 480 - 134K
Sign In or Register to comment.