NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Project Help and Ideas » Does this Code look Correct?
January 20, 2010 by Phrank916 |
This is part of my 1 joystick / 2 servos project that I'm currently forcing myself to accomplish. I've been posting about it in the Sensors, Actuators & Robotics section of the forum, but thought I might get a quicker response in this section to a request for "debugging" help from some of the bigger brains, heh. I'm calling this little program: joystick calibration utility. It should read both axes of a joystick and display the ADC reading for each in real time to the LCD. I'm hoping this will allow me to find the center reading and the extent of the range of each axis. Also, it should show any wavering when the joystick is centered (at rest) so I can code in a small "dead zone". I've already successfully edited some of the tempsensor code to read one potentiometer and output the ADC reading. Today I just did a bunch of editing to the code while I'm here at work, but don't have my NerdKit with me to test it. I am also waiting for a couple eBay sellers to send me my new soldering iron so I can solder up the PS2 controller I've torn apart and "Frankenstein'd". I'm very new to C and I'm not sure if what I've done will even work properly. Any feedback is VERY welcome!!
Ted |
---|---|
January 20, 2010 by Phrank916 |
Well, nevermind... I got home and tried it. The compiler kicked back errors and line numbers and it took me a second but I realized I had missed two semi-colons. But after making the correction, I hooked up two little test pots on the breadboard and it's working as intended. :) I've also added a line to turn off the digital input buffers on both channels.
The spec sheet said it saves power. I'm all about green. ROFL! Ted |
July 23, 2010 by VictorsNerdery |
hey you seem to have things in order. I was wondering is there a programing way to reverse the current flowing from the MCU pins? |
Please log in to post a reply.
Did you know that a NerdKit can be used to build an iPhone-controlled R/C car? Learn more...
|