Input from transmitter on Channel 5
Checks the status of limit switch A and B
If A is 0 (Open) and B is 0 (Open)
Then motor port 1 travels CW to Limit switch B and stops when limit switch B is 1 (Closed)
(Ends here to wait for input to cycle again)
If A is 1 (Closed) and B is 0 (Open)
Then motor port 1 travels CW to limit switch B and stops when limit switch B is 1 (Closed) Led 16 lights to indicate limit activation.
(Ends here to wait for input to cycle again)
If A is 0 (Open) and B is 1 (Closed)
then motor port 1 travels CCW to limit switch A and stops when limit switch A is 1 (Closed) Led 15 Lights to indicate limit activation.
(Ends here to wait for input to cycle again)
If A is 1 (Closed) and B is 1 (Closed)
Then motor remains stopped and LED1 flashes 5 times at 1/2 second off 1/2 on
(Ends here to wait for input to cycle again)
Here is what it is doing so far. I’m very inexperienced at programming less than 1 week worth.
I’ve managed to get the motor to move clockwise (CW) to limit switch b. but when it activates limit switch b it moves counterclockwise (CCW) to limit switch a. and the cycle just keeps going on and on. I have the indicator LED’s working when the switch is pressed they light up and when no longer pressed they go off.
I am working with Easy C v2. Having lots of fun but the programming insert for the inventers guide isn’t all that in depth. and the help files are great but I’m just not getting the understanding of it.I click the examples and checked the sample code but theres just no explanation of why… I’m thinking of taking a programming class at the local community college but not sure what kind of language Easy c is… I’m going to go out on a limb and say it’s C but may not be the same version.
here is my code. I’m sure it could use some cleaning up.
P.S.
Does anyone know of a simple way to get the code output like this without having to type it? Was a bit intense. and i’m completly responsible for typo’s.
Whew… Stumbled across some sample code and tore it apart learned a whole bunch… While it’s not a routine like I was hoping for it’s good code. Tests great on my test rig. The sample was included on the cd which I later found copied on my hdd in a totally different area than where I thought it would be… thats besides the point… Now if I could just figure out how to slow the motors down… Where can i upload the code? …Now to get the nephew ungrounded so we can finish the truck itself.
Looking at your Programming Issue, will get back to you on it…
Here is a Trick, works with EasyC v2, but not with EasyC Pro (v3) I need to report that…
Load your EasyC Project.
Click the Project Tab at the Bottom of the Left Window.
The Left Window changes to show the different files than make up the project.
DOUBLE Click on the Main.c file under Source Files.
The Window on the Right shows the Source Code for the Main Function.
On the Right Window, Right Click on it and the Click, Select All.
Now Right Click and then Click, Copy.
Click the Child Window Close Button (The ‘X’ in the upper Right corner), to Close the Main.h Source Windows and see your EasyC Drag-and-Drop Window again.
The entire Source Code of the Main.c Module is in the Windows Clipboard.
NOW, On Vex Forum…
Start your Thread, or Reply or Quote, whatever it takes to get the Editor Box.
Use the Tags CODE, around your Source Code.
(I type the Code Tags in, (e.g. CODE ] /CODE ], with no spaces between the Brackets and the words CODE and /CODE), and then Paste from the Clipboard right between them.)
When done like this, it looks like this:
#include "Main.h"
void main ( Void )
{
int limita = 0;
int limitb = 0;
int rx5 = 1;
char x;
char x2;
...
The CODE Tags also preserve the Tabs and White Space, so your Source Code stays nicely indented…
BTW, EasyC Pro (v3) will let you click the Project Tab, but won’t show you any of the Source Files. I find this a very discouraging bug… Makes it real hard to Copy the Code out…
The EasyC Samples are quite valuable… The Older Versions of EasyC located them with the EasyC System in the Program Files directory. Vista (and Windows 7) don’t like that, so the Samples were Re-Located to the Users Profile Directory.
Your Pseudo Code Logic is more complete than you Code, but there are Holes Still in it…
As Documented, the Fourth State, can never be obtained, [FONT=Courier New](A is 1) and (B is 1)[/FONT] unless the Motor is at Both End simultaneously, unless you want to detect that each of the ends has been reached at some point in the run of the program.
Can you fill in a few more details…
I actually have 4 -5 pages of comments on your code, but the further I go, the more Paths I have to consider without knowing how you want to proceed…
Correct the 4th state should mechanically never be possible unless a failed switch. and thus the reason for the possibility for the code. don’t want to drive it into a switch that has failed. the equal is also turn if the switch doesn’t make contacts then it will never know it has reached the limit. So in all actuality the 4th state can be omitted.
If you would like you can click my name and send me a pm with your questions and i can answer them. it actually goes back to my email and not on site anymore i think there was a post talking about the pm feature being disabled at some point. or i’ll just post it here and hope no bots see it.
i d m i l l e r @ y a h o o . c o m. of course no spaces.
Also it will give me an oppurtunity to send you the code i got working which does what i’m looking for but requires constant user input for travel and i’d like it a little more automated.
I was quite proud that the code actually works as intended and it only took 37 hours this weekend to do 90 lines… hehe. but the knowledge i gained was well worth the time spent. I also have some pics of the frame work i’m going to try and get posted this afternoon. i just got off work (3rd shift) and had a rough day yesterday so i’m pretty beat.
and in refrence to the PID in another thread i do belive the 1st generation encoders will not work with that so going to have to get a couple packs of the quads.
thanks for everything. you’ve pointed me in alot of right directions and shown alot ideas i wasn’t aware of.
you do know that with the length of your base and only 2 motor drive and no omni wheels, it would be imposable for it to turn right?
i would shorten it a bit and if the rest of your design doesn’t allow that, then at least have 4 motor drive
the 5" wheels also might have too much friction, im not sure on that one though
nvm i thought your gearing was 1:1
but i still think it will have a hard time turning
Yes i sure do. Thats what this whole thread was about I’m looking to automate a lift sequence to lift the frame off the ground. the device is not present in the photos because i havn’t found an acceptable idea yet to mount the lift that won’t look too far out there. It has 2 omni directional wheels that are 90 perpendicular to the drive wheels so it uses the 2 rear wheels to turn.
Actually the gear ratio is working really well it’s not nearly as slow as i thought it was going to be about a foot every 6 seconds. speed wasn’t a concern as much as letting him use his imigination. and giving experience to my nephew of why some things are better.
that is correct. i’ll have to go back and count the gear ratio if you would like. can’t remember it right off the top of my head.