![]() |
PBasic Question
I'm new to programming PBasic...though I know a little of C and C++(very minimal though :( ) I was wondering, how can I start learning PBasic and/or find out more on this programming language?
Anything would be helpful!:D |
My advice would be to grab the default code from InnovationFIRST's website (http://www.innovationfirst.com) and go through it line-by-line until you understand it.
After that, I'd try playing around with my emulator (http://FIRSTprograms.tripod.com/Programs.htm) and see what comes out. If you ever run into problems, post them here and you'll get an answer in a few hours at the most. Also, if you feel like a challenge, here is the code we used last year: http://FIRSTprograms.tripod.com/cog2002.txt |
Quote:
|
Thanks for the help!!! The http://www.innovationfirst.com was probably the most helpful (with the default program and all....:D )
|
Even more fun!!
1 Attachment(s)
Here is some Swerve code broken into processor slots if you get bored.
Hopefully your team can get the edu robot to try out or get your hands on a IFI controller. For right now the emulator is great also. Thanks for the hard work rbayer! PBasic is not that hard but living in the hardware limitations is more difficult. |
Quote:
if ((gear_shifting=1) and (gear_count=10)) then shift do you have to press the top button of your joystick 10 times to shift? I'm still learning this code so if this is a stupid question feel free to flame me. |
Quote:
BUt I am not sure where gear_shifting ever gets reset back to zero after the first initialization.? |
How long
Do you have any idea how long it would be? Does is there a preset time for counter-type variables, or does it depend on the rest of your program?
|
startShift:
leftDrive=127 rightDrive=127 gear_shifting=1 gear_count=0 also what is this here for? p1_sw_top_prev=p1_sw_top I see that it sets p1_sw_top_prev=0 but why not just say that? |
Quote:
Anyway, Rob will be back in an hour and explain everything. |
Quote:
Gear Count =0 will set up a fresh delay since it increments to 40 and stops incrementing until the next time a gear shift is requested. Gear Count would be at 40 coming into that statement p1_sw_top_prev=p1_sw_top this type of statement is useful for storing the value of the switch on the previous scan and checking the current state against what you had before to see if a change has taken place, kind of a 1-shot since after the current scan they will both agree again |
how long
Can someone on this team tell us about how long the delay is?
|
This is from the archives I assume it to be close
close enough for govt work... Posted by control guy at 1/29/2001 10:29 AM EST Student on team #250 from HVCC. In Reply to: Re: PBASIC Loop Speed? Posted by Lloyd Burns on 1/28/2001 4:38 AM EST: The program loops are roughly 1/40 sec. Although, the time between loops can vary if you lose signal momentarily. Also, depending on your code, a program loop may take longer some times around than other times. Such as if you had many strings of if statements and you're having the program go here, then here, then here, etc., etc. Hope this helps. |
Ok, I'm back (sort of). Actually, I'm sitting in my CSci class right now, but I don't really feel like listening, so I'm responding here.
The p1_sw_top_prev=p1_sw_top does exactly what Matt said, it stores the state for the next loop. Since almost no one can press and release a button within 1/40th of a second, we need to make sure that it is actually a "new" button press and not just someones finger left on the switch from earlier. This lets us use the top switch as a toggle. I.e. each time you press it, the gear we are in changes. As for the timing, it ends up being about 1.5-2 seconds from the time you press the button to the time you can drive again. That is for the full 40 loops. The 10 loop part takes approx. 1/4 as long. If you can understand this type of time-delay, you have a very good grasp on PBASIC as this type of looping isn't overly intuitive. Anyway, let me know if there are any other sections that are unclear or don't make sense. --Rob |
Re: how long
Quote:
|
Macs
Ahh the sadness of the macintosh
:( |
Will there be a default program with the edubot? (If this makes any sense...):confused:
|
yes, and its already posted if you want to take a look:
http://www.innovationfirst.com/FIRST...umentation.htm |
Quote:
|
I'm assuming CSci = Computer Science. . .
|
Sorry about my prior statement being a little random...but maybe that's how you can log in from class...Computer Science class...possibly? ( I was wondering the same thing...)
|
My laptop has a .11b card and the U of MN has a wireless network. Given that I'm sitting smack dab in the middle of 2.5 hour lecture right now, my wireless card saves my sanity.
Also, some of my classes are actually in computer labs, so sometimes I just use the computer sitting in front of me. (In case you're even more confused now, I am still a high-school senior, I just take most of my classes at the U) |
How many classes is "most of my classes"?!? (Sorry if this is way off topic...):)
|
3 of the 4.
I take spanish at my high school, and physics, computer science, and Modern Fiction at the U. Next semester it will be all 4: math, physics, computer science, another computer science. |
(Sorry again...off topic) Two Computer Science classes?:confused:
|
Yes.
1. "Discrete Structures of Computer Science"--its actually more math than CSci, but it's still considered a CSci class. 2. "Machine Architecture and Organization"--basically assembly and OS design. Other than that: 3. Calc IV 4. Calc-based physics II--electricity and magnetism |
How is your school system set up?
We are required to take core courses (English, Government, Math, Science) our senior year. |
We just have requirements that we have to do at some point during grades 9-12. I managed to finish everything by halfway though my Junior year, so I basically get to do whatever I want.
|
Quote:
|
| All times are GMT -5. The time now is 04:22. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi