Maybe I’m just tired, but I didn’t see anyway to attach the program to a private message so I just had to send it in a regular post to the forum.
I looked at one of your programs and I made a few changes to the user control function. One thing I wasn’t sure about was whether or not the encoder needed to re-started after it was preset back to “0” in your “elseif” statements. I went ahead and added that plus simplified your code. I just set it up the same way I check my limit switches so it should work.
The only real problem I forsee is that you are running the motor at full speed and only counting a very few clicks. I’m just not sure if the program can respond fast enough. The Quad Encoder or potentiometer would definitely help.
You might want to consider slowing the motor speed down or adding a set of gears to speed up the encoder. That would give you more “clicks” per rotation of the motor which might make the arm easier to control. You would just have to try it and see.
You may need to change the operators on the “if” statements if I didn’t get them right, but here is the zip folder with the changes I made:
Dreadnaught help.zip (2.73 KB)
Sorry, but the code I posted was bad. I guess that’s what you get when you are tired because you have been up too late.
I didn’t have a chance to test it, but I think this one should work. If you try to move the arm up or down and the encoder is “>= 19” then the arm should stop. Else the arm should move the opposite of the button you push on channel 5 just like you had it.
Let me know if it works or not. I would have tested it myself, but it’s really late and I would have to check to see how to set up the microcontroller to skip the autonomous section.
After I posted the first code, I realized that it wouldn’t work and I didn’t want to leave it until morning to fix.
Dreadnaught help (2).zip (2.76 KB)
Well, I guess I should have waited until morning to fix the program because as soon as I got into bed I realized that I had made a mistake the second time too. It was one of those stupid little mistakes that you make when you are tired.
Dreadnaught1031, if you are still interested in some help with your program, just let me know. The mistake is simple to fix and I can post the corrected program along with an alternate one that should work too, if you want to try them.
yes, i am still interested.
sorry i didnt reply until now, i thought we were just doing individual messages.
i’m still playing around with and testing the edited programs. ill get back to you on the results when i can
I will try to get the code fixed and posted for you as soon as possible.
I’m sorry for the confussion. I know we were just doing the private messages, but I didn’t see anyway to attach the code to them. I would have gotten back with you sooner, but I was working on my own robot and hadn’t checked the forum for a few days.
I saw that you are logged into the forum right now and I have the 2 versions of the program ready to go. I think they both should work, but I think the first one is probably the better of the 2.
Anyway, give them a try when you get a chance and let me know if they work (I didn’t test them myself). I hope they help.
Dreadnaught help 1.zip (2.74 KB)
Dreadnaught help 2.zip (2.82 KB)
Thanks for all the help man, but I kinda gave up on the idea. I mostly wanted it because i was told i was going to have to share control of the robot driving, but i don’t now so i’m not worried