![]() |
Just a little question...
Hey everyone. I'm learning how to program right now, being taught by my team's lead programmer. I was wondering if any of you might know a good online tutorial, or maybe even a good book that teaches programming? Tutorials in both C++ and PBASIC would be cool...so if you guys know anything, let me know? Thanks.
|
|
This is definately Rob's (rbayer) area, but he is ironically at his CompSci class at the U of MN right now. Try looking at HowStuffWorks "Software and Programming" located at http://www.howstuffworks.com/category.htm?cat=Program . They have tutorials on C, Java, PERL, etc. In addition, http://www.techtutorials.com may also be helpful.
|
1 Attachment(s)
I attached a zip file with my code from our last year's robot. Included is some programming guidelines you should follow when programming your robot (put together by one of our EEs). They are good programming ethics, your time will be much easier in the long run if you study them and follow them. Take a look at the program and you'll see what I mean.
You'll need the PBASIC documentation from Parallax: http://www.parallaxinc.com/downloads...ual%20v2.0.pdf It contains everything you'll need for understanding the code. You'll also need the PBASIC editor from Parallax: http://www.parallaxinc.com/downloads...p%20Editor.exe |
Aw, thanks everyone, this is going to help me a lot! You all rule!
|
I'm back now. Anyway, for learning PBASIC, follow the suggestions given in this thread.
As for learning C/C++, you're probably best off buying a book. I have C++: How To Program by Deitel and Deitel. It literally taught me everything I know about C++, and that was just the second edition. They're up to a fourth now. As soon as I finish some of my current projects, I may go ahead and write a PBASIC/FIRST primer, covering all the basics as well as some example code, etc. In any event, if you run into trouble with either PBASIC or C++, just ask in this forum and I (or someone else) will probably get back to you within a few hours. --Rob |
The CODEX
Check out the articles section here:
http://www.first-codex.net |
Re: The CODEX
Quote:
Ahh... I was wondering where that went... All the old links I had were inoperative. But, yeah, the codex is the best place. As for those Design and Code Review guidelines, you're supposed to use them in the coding process. Here's the general process. 1. Figure out what your robot is going to do. 2. List all things that are going in our out of the robot controller. They need coding. List what they hook up to (That's what the documentation is in the zip file). 3. Divide the parts of the robot into clearly defined areas (subroutines) (look at my sample program, there's a drive area, a controls area, compressor area, grabber area, a window motor area, a pneumatic cylinder area, etc.). It's up to you how far you want to divide it. The more you divide it, the less the code is inter-dependent (one thing wrong messes up the entire robot = no no). However, the more you divide it, the more complex it becomes. There's a certain point where this is balanced. I won't say that my way is best. It all depends on the programmer's preference. Use the Design Review guidlines while you are writing this up. After it is completed, gather peers together and go through it. 4. Write in paragraphs (english) what each section of the robot should do. 5. Now, translate these paragraphs into PBASIC code, or into pseudocode (a hybrid form of english and the desired coding language... no specific code is formed, but an outline is formed. if statements and such should be included to illustrate structure). For example: Code:
drive area:Of course, all these recommendations depend on if you like object-oriented code. My attempt at coding was to make PBASIC object-oriented. It succeeded, but object-oriented isn't what PBASIC is intended to be. Object-oriented means that there are certain areas of the code (functions, subroutines, etc) that are designed to accomplish a specific task. These functions/subroutines are then called by the main code to accomplish these tasks. C++ and JAVA are object-oriented programming languages. BASIC is not, however (along with many others). |
Re: Re: The CODEX
Quote:
As for object-oriented, what you are actually talking about is "modular" or "procedural" programming (it's NOT "functional", despite what many people/books say). Object-oriented would imply that you somehow encapsulated the data and functions into one big "object." The only real way to semi-sorta-kinda-maybe do object-oriented stuff in PBASIC is to use multiple program slots. That way, all the variables are stored in the same place as the functions that manipulate them. Even then, the data can manipulated by any object at will since everything uses one shared block of memory. In either event, breaking your code into small pieces is a VERY good idea. It will make debugging much easier and will make it far simpler to make changes some time in the future. |
| All times are GMT -5. The time now is 01:17. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi