How did you learn to program?

i would really like to learn c over the summer.

what do you suggest to learn the basics?

Take a look at easyC, it has a lot of helpers.
Buy a book on C, it won’t all be relevant, but the basics will help.
Program your TI calculator, it’s in TI-basic, not C, but the basics of programming, are still there.

I taught myself Microsoft QuickBASIC from a book and compiler made back in the 80’s… it really teaches you everything you need. After you learn the logical part of programming, its just syntax after that for computer programming, and that you can find from any old place online, wikipedia will point you in the right direction for links.

However, when you move on to programming embedded processors things get a little more complicated, if you want to take advantage of the parts. There, I suggest you get an 18F series microchip development board such as the HPC explorer or just use a first controller… though learning hardware on the FRC controller isnt such a good idea since many of the pins arent run straight out of the proccessor, or sometimes cant even be accessed by the processor.

In the hardware department, once you learn (E)CCPs (in all of their various modes), ADCs, Timers (and how to and not to use them), Interrupts, Tristates, that about puts you where you need to be.

A touch of assembly never helps… I know a little and the concepts behind it so sometimes it can get you out of a hole you might not be able to get out of with c, and it almost always is more efficient if you need to do something REALLY fast.

if you need any help just give me an email or pm, i’m always happy to help somebody starting out.

team 1024 will be at boilermaker, buckeye, and atlanta, so if you will be at any of those too just ask anyone from 1024 for “Q” and i’ll come on over.

-q

Like tawnos23 some of first programming experiences were on my TI-83. Though my first computer language was VB 6. The thing I like about VB was how simple it was to read. It allows someone who really doesn’t know much about programming to really just jump in. If you really just want to learn how to program for FRC I wouldn’t really bother with an actual C book, I would check out a lot of the whitepapers here.

Once you have the basics, topcoder is a decent way to cement your skills with algorithms and STL. Warning: anything beyond the Div 2 250pt questions are quite difficult.

As for the basics, just find a task that you want to program, and program it. I just finished a program to parse a text file of FIRST results, it was about 1000 lines or so.

I picked up nearly all of my C++ skills from the first chapter of a DirectX programming book, which had a very nice introduction to the language. However, I had already programmed a lot before, so it wasn’t new.

Another option is go to a university’s website for their introductory computer science courses and see if they have assignments for download. These will give you tasks to do that are oriented towards steadily building your knowledge.

FORTRAN on punch cards…still have the textbook…

Seriously, if you have something that you really want to make work, that requires programming, that’s the best way to learn. You’ll be highly motivated.

My two sons who can program started with Qbasic, although it can lead to bad habits.

If you really want to understand how computers work, find an old beginning assembly language programming book and an old computer and have fun with it…or as suggested, get into the PIC microcontrollers.

If your school offers a Computer Science course, take advantage of that. They usually teach you Java, but as the others have said, it helps out alot when it comes to just understanding how programming logically works.

hmm… a while back i wanted to program a videogame, so i picked up a copy of GameMaker. After you get by the drag and drop stuff, its syntax is very similar to C’s, just without the confusing stuff like pointers and class definitions.
I then realized the limitations of an interpereted language and picked up a book on C++. much of the stuff that i read within it i only had a vague idea of- like pointers and data structures (those damned pointers). The only way i was actually able to solidify that information was via application- programming the robot.

by the end of last year i think that i learned all about programming that i would ever need to know for the PIC architecture… which is now why i am trying to solidify that information by teaching it.

now the next problem is to go back to windows programming… eek.

We used easy c this year and i was completly new to it. I learned it during the build season so you can probably learn a lot about programming with a whole 3 months or however long summer is. Easy C also comes with a long help screen where you can trouble-shoot and learn what everything is used for, its really a great program.:smiley:

well the thing is, we are a rookie team and we have one really good programmer that can work magic with c :yikes: and it does not take him very long so there is no need for anyone else to learn it.

and we also do not have a shop and the robot is usually stored at a parents house(his garage comes fully stocked with lots of tools and stuff).

and i live in an apartment so if i took the robot i would probably prevent someone else from working on it.

i think i will learn in the summer if they let me have the robot. (i was planning on building myself a smaller robot during spring break from the same parts in the robot that is has a 12"x12" foot print and is about 6 inches high so i can practice programming and play around)

I learned to program with my TI 83 in 8th grade, the I took a class at my high school freshmen year, where I learned JAVA and C# which really helped me learn about programming logic. That summer I read through all of the default code trying to understand as much as possible and to figure out as much of the differences in C, then when Kevin’s camera code came out last year, I did the same thing again. Once you read through and understand it try and make your own. I do that now in my web design class when the teacher gives us code that we can modify to fit our system, I read it and try to make one myself that is simpler.

In fourth grade, I really became obsessed with wanting my own website, but the hard way with html, so I got a few books from the library, looked at some source, and learned like that. In websites, I started to want to make more advanced stuff, so I began learning php and javascript, both of which are similar to c and c++ in a lot of ways. After that, I wanted to design my own programs for the computer which is how I got into c/c++ and other languages which all came naturally after php and javascript, so basically start small, build your way up. The more advanced programs you make, the more rewarding you find it so challenge yourself. Sometimes I found that doing a project that is far too advanced for me and struggling through it to finish it helps me with all the smaller projects.

Read, read, read books and source code!

sounds like you need a VEX kit and the programming kit for it…any chance your team would buy one?

it depends on how much a vex kit costs:)

I think that the Vex kit is around 300 USD but you may be able to get just the controller and program kit from another team for cheaper if they have one they aren’t really using.

hmm not sure we have that much money lying around.

lets see we had 10000 dollars that sponsors gave us.
-cost of the KOP which was ~6000 dollars i believe.
-cost of all the stuff we bought ~1000 dollars mehaps. (not too sure on this.)
-cost of regionals which was around 1000 dollars.
and we have less than 2000 dollars…

hmm ill ask.

I say you should get a VEX kit, learn EasyC, and then take a look at C(if EasyC doesn’t do what you need).

you can also look here<http://www.usfirst.org/community/frc/content.aspx?id=482>

I agree. I used those power points in 2004 when I was new to programming. Now I’m a computer engineering major:cool:

Now, im not exactly a programming wizard (as Karthik1 will attest), but i can write a program that will control a robot simply, and write an auto mode that will get by.

The best way to learn is to immerse yourself in it. Just like learning anything else. So, i say just start doing it, and when you know what you want the logic to do and dont know how to convey that into C, read a book or check the internet. That way you learn the important functions and capabilities of C through their application in a real world situation instead of just words on a page

I started programming because nobody else on my team knew very much about it, and it seemed interesting. I knew nothing at all and struggled with a short amount of time before ship to test my program, but we did well and the code worked like a charm (we didnt use auto mode too extensively).

I say go with Nike on this one. Just Do It. :smiley:

You should check out ebay you might be able to buy a Vex controller for cheap. Then you just need a programming kit and your good to go. You can use a victor and some cheap POTs, Kit Gyro, and Gear Tooth Sensors for feedback and your off and running.

Every FRC team has one seat of easyC Pro that we gave out in the KOP.