Jump to content

emklaus

Members
  • Content Count

    8
  • Joined

  • Last visited

  1. Hi santhakumar; Sorry I don't have code for an NEC remote. Even if I did it would most likely not match yours. Most remotes are specific to the device they come with, even those of the same brands. You might be able to use my project to figure out code for your NEC remote. Check out the notes in the readme.txt about how to figure out the "codes" your remote is sending out. if you set it up and send me the results I might be able to help more. Good luck. Eric
  2. emklaus

    Hobby servo motor project / tutorial

    You've got the right idea there! I can see a couple things that would help you out. keep in mind that the while() loop you have your button code in is running at full speed as fast as the processor can go. So when you press and hold the button it’s going to increment the iPulseWidth variable as fast as it can. I imagine it gets to it’s limit by the time you let up on the button. (in my demo the timing of the “+” key signals was controlled by the keyboard repeat rate the buttons on the board don’t have that built in ) Looks like you’re trying to learn a bit of C here so I won’t give you actual code right away. (if you don’t figure it out with a reasonable effort let me know and I’ll send some actual code) So first you need to de-bounce those buttons. See if you can code something like this: Define a variable for a de-bounce counter and set it to zero Read the button. Is the button Pressed? No =reset the de-bounce counter and exit this loop Yes = increment the de-bounce counter delay 5 milliseconds has the de-bounce counter reached 20? yes = exit this loop no = back to read the button again When you exit the loop, if the counter = 20 it’s s good button press (this means you’ve held it down for at least 100ms or 1/10 sec.) otherwise just go on to check the other button the same way. Adjust the delay value and max de-bounce count values to get the results you like. Once you’ve verified a “Good” button press you may also want to check for a “good” button release (say for at least 10ms) That depends of course on if you want to have the servos move while you hold down a button or if you want to require the button to be released before registering the next movement. Get the idea? You can find many articles on de-bouncing buttons online. Here’s a good delay routine: ROM_SysCtlDelay(ROM_SysCtlClockGet() / speed / 3); (when speed=1 delay = 1sec.; speed=2 delay=1/2sec.; speed =4 delay = ¼ sec; speed=10 delay=1/10 sec and so on…) Good Luck Eric
  3. emklaus

    Hobby servo motor project / tutorial

    Hi Spikerbond; Thanks for taking a look at this demo project. The key to getting the servos to move is all in the values held in the global array g_ulServoPulse[ ] It contains the values that the interrupt routine will use to send pulses to the servos. In this demo the array contains values for 3 servos (servo# 0, servo# 1 and Servo# 2) as well as a fourth 20ms value. So when you add your code to support the button press, you only need to add or subtract from one of the first 3 values in this array to move any of the 3 supported servos. If you look at the original code (around line# 244) you’ll find the bits of code that handle the pressing of the “+” or “-“ keys from the terminal program input (see “case ‘+’:” and case ‘-‘:”) that’s where I actually update these values. The iSelectedServoNo variable is set when you press “0”, “1” or “2” from the terminal (it defaults to zero) Those keys also read the current pulse width value from the array for the selected servo into the local iPulseWidth variable. So pressing “+” or “-“ just adds or subtracts the current step value and updates the global array. The values in g_ulServoPulse[ ] are in microseconds of pulse width. So 1500 puts a standard servo at about mid-point. Be sure to keep the numbers you put in there within a reasonable range for your servo (see MAX_SERVO_PULSE_WIDTH and MIN_SERVO_PULSE_WIDTH) Hope this helps you with your modifications. Please send me more details about what and how it stops working. Which command are you sending and about how many before it stops? Is the whole application crashing or only the servos movement? I’ve heard of terra term but I’ve never used it. Shouldn’t make a difference for this application. I might be able to help you with making putty work though. Good Luck Eric
  4. Thank You ! Here's My Address Info: Eric M. Klaus 29 Dogwood Lane Glastonbury, CT 06033 U.S.A.
  5. IR Remote Control Demo Project for the Stellaris LaunchPad Evaluation Board A demo to read Sony IR remote control commands using TIMER1A and PORTA PA2 Requires an IR Receiver device( TSOP1738 or similar ) connected to PA2 and a TV remote control. What you will need: First you will need a reciever/detector device like the TSOP1738 from vishay. That particular device is tuned for a 38khz carrier (most common) but if you happen to have a 36khz or 40khz device it will probablay work too. The one I used worked fine at 3.6v and can be powered right off the board. It's a 3 pin device, GND, VCC and Output. Next thing you'll need is of course, a remote control. I found a universal remote at a "dollar store" but you probably have a programmable remote lying about. ============================================================================= I've attempted to set this demo project up for those just starting out with The Stellaris LaunchPad Evaluation Kit. I tried to keep things simple. There are plenty of comments in the code to help. ============================================================================= Comment & Questions are welcome Eric IR_Demo.zip
  6. Excellent News! - What do I need to do next?
  7. emklaus

    Hobby servo motor project / tutorial

    Thanks for the info. Glad it was helpfull, that was the intent.
  8. This is an RC Servo demo project for the Stellaris LaunchPad Evaluation Board This particular demo will drive 3 motors with commands from a serial terminal. I've attempted to set this demo project up for those just starting out with the LaunchPad. The code could be optimized quite a bit but I was trying to keep it as uncomplicated as possible. There are plenty of comments in the code to help as well. Send your comments my way but be kind as I'm really just starting out myself. Enjoy. Eric servo3.zip
×