This is the second year we’ve attempted to teach C to some students with absolutely no programming experience so I can offer a bit of advice.
Last year we tried the textbook method and started with programming basics by giving them examples on the board of expressions, assignment, conditionals, loops, etc. We then moved on to an overview of variable types, arrays, and other fun stuff. I’m not exactly sure what we did next but it doesn’t matter since that approach was an absolute failure. The students were bored so they didn’t pay attention, and the material they learned in one class they forgot by the next. The mistake we made was we tried to give all the details and explain the theory behind everything we tought. What a disaster.
This year we tried the complete opposite. From the start we did a bunch of hand-waving over the details and told them that we’d explain it all later. We wanted to get them writing code on day one. We explained the very basics of C: you write some code in a text file, the laptop converts it to code the RC can understand, then you download it to the RC. We showed them a C file, then we broke up into small groups and tackled some pre-planned exercises. Wildstang is fortunate to have many mentors who write software for a living so we had four groups each with one mentor and two students. The exercises used two joysticks, the LEDs on the RC, and 4 servos. We tried to base them on concepts we will use when we start programming the robot in January. We started with easy exercises and increased the difficulity as we progressed: direct map of a joystick to a pwm, proportional map, direct map with a cap on the output, direct and inverse map of joystick button to LED, LED toggle when button is pressed, add to & subtract from pwm when buttons are pressed, change pwm direction when button is pressed. As the groups wrote code they would download it to the RC and test it. The groups worked the exercises as a team and the mentors explained the concepts of assignment, expressions, and contitionals as the group encountered exercises that required it. We found this method worked extremely well; the students were excited because they got to write a few lines of code and immediately test it, if a student didn’t get a concept the mentor with that group was able to spend more time explaining it until it made sense, and the students got to see how exciting programming is :).
Our goal this year is to keep the students excited and engaged. If we have to gloss over the in depth details in order to teach the basics we’ll do it. Once they get the basics and start asking questions we’ll teach them as much as they can grasp. Once they get that we’ll go deeper. I can’t ask a bunch of students who have no programming experience to write a PID loop from scratch, but I can hand-wave the theory of a PID loop and have them write a few lines that set the PWM value, then have them write a few lines that calculate the ‘P’, then a few more, and by the end they’ve written a PID loop. Then I can explain the details & the theory. Hopefully this method works.
Teaching software to complete newbies is not an easy task because it involves thinking in a way that they’re not used to. You’ll have to work one-on-one with each student to make sure they’re getting all the concepts. Don’t walk them through anything, have them do the typing. Have them write some code as soon as possible, they’ll learn it better and be more excited than if you just explained it on the board.
If you want me to upload the code we used for the exercises, just ask.