EasyC Lesson Plan

Hey there, everyone. A week or so ago, I mentioned that our team was considering doing some videos on YouTube explaining how to use EasyC to program robots, both for driving and during the autonomous period. After building a robot this week and adding some sensors to it, we’ve developed a plan for what order to do all of this in. Each main heading is a separate lesson, with additional details as to what is in those lessons. Because the spacing of my list keeps collapsing, I’m using code tags to keep it all straight.

1.Lesson One- Getting Started
   a.Physical Connections
     i.USB-USB Cable
     ii.Wireless Download
   b.Installing Firmware
     i.IFI Firmware Loader
   c.Controller Configuration
     i.Labeling Motors
     ii.Input/Output
     iii.IMEs
   d.Comments
     i.USE THEM
2.Lesson Two- Defining Variables
   a.Global versus Local
   b.Types of Variables
3.Lesson Three- User Code
   a.Using Semicolons
   b.Illustrate the checking method of the compiler
   c.Increments and changing variable values
4.Lesson Four- Mapping Joystick Inputs
   a.Analog Drive
   b.Tank Drive
   c.Holonomic Drive
   d.Moving motors with joysticks
   e.GetJoystickAnalog
   f.Setting Analog Deadbands
5.Lesson Five- Joystick Digital
   a.Moving a motor
   b.Moving a piston
   c.Changing Variables
6.Lesson Six- Using a Gyroscope
   a.Initializing and using sensors
   b.Explain the deadbands
   c.Output to LCD Screen
   d.Output to Terminal Window
7.Lesson Seven- Using Ultrasonics
   a.Initializing and using sensors
   b.Output to LCD Screen
   c.Output to Terminal Window
8.Lesson Eight- Using Bumpers
   a.Initializing and using sensors
   b.Output to LCD Screen
   c.Output to Terminal Window
9.Lesson Nine- Using IMEs
   a.Initializing and using sensors
   b.Explain why NOT to use them in EasyC
   c.Output to LCD Screen
   d.Output to Terminal Window 
10.Lesson Ten- Programming Flow
   a.While Loop
     i.Will repeat while condition is true
     ii.All programs go in a while == 1
       1.Gets joystick and variable values
     iii.Get sensors at the end
   b.If Statement
     i.Make code more complex
     ii.If/Else gives two options based on a conditional
   c.Switch
     i.Defines which variable tested
     ii.Break used to exit the switch
       1.Otherwise, will proceed through all cases
     iii.Continue will exit the case and move on
     iv.Default will run if no case is true
       1.Used for error or catch all
   d.Timer
     i.Wait while something happens
       1.Useful for basic stuff
11.Lesson Eleven- LCD Screen Menu
   a.Set the backlight
   b.Define the necessary variables
   c.Explain If/Else Statements
   d.Increment Variables
   e.Add value to variables
12.Lesson Twelve- Autonomous Control with Individual Motors
   a.Defining Variables for easy motor selection
   b.Start and Stop motors
   c.Time based control
13.Lesson Thirteen- Autonomous Control with Smart Driving
   a.Time Control
   b.Rotational Control
   c.Define Motors
   d.Drive
   e.Turn Swing versus Turn Center
14.Lesson Fourteen- Wait Until Functions
   a.Sensors and Variables
   b.IME Speed
15.Lesson Fifteen- Jump Between While == 1 Loops
   a.Explain Uses
   b.Variable based on face buttons
16.Lesson Sixteen- Holonomic Strafing
   a.Conditional Statements
   b.Variables based on shoulder buttons
17.Lesson Seventeen- Battery Inputs
   a.Main Battery
   b.Power Expander
   c.Backup Battery
   d.Conditionals to say “Change Me”
18.Lesson Eighteen- Selecting a side of the field based on sensor input
   a.Ultrasonics
   b.Conditional statements
   c.Assign variable
19.Lesson Nineteen- Write to internal flash memory
   a.Explain why we need it
     i.Skip Initialization period between Autonomous and Driver
   b.Explain the code process
20.Lesson Twenty- Branching Autonomous Modes
   a.Conditional Statements
   b.Why to do it

At a later date, we would also be interested in doing videos on the following;

Using Line Followers
Using Color Sensors
Using LED Lights
Using Potentiometers
Using Limit Switches
Using an Accelerometer

However, we would need to order more of the sensors to make these videos.

We’re also interested in making videos illustrating the pseudo-multithreading that is possible in EasyC. I’d also be happy to do a video walkthrough of how to implement the speaker code that jpearman wrote (with his permission).

And as to why I’m posting all of this here, we’re looking for suggestions. If you have any requests for us to do, we’d be happy to add them to the list of projects. This isn’t just something to do over the Summer, we’re really trying to make coding accessible for everyone. So, if you have any comments, concerns or ideas, please feel free to submit them.

Thanks.

I love all of the topics. I would teach the joystick before the user code, but not a big deal. i also would go with program flow second or third. I would also teach potentiometers sooner because they are so useful in competitions. Just some suggestions. It looks great overall.

There are a few points that I would like to add (as I’m a fully qualified teacher :rolleyes:, kidding) is that if you’re going to a lesson on IMEs and explain why you shouldn’t use IMEs in easyC, then don’t talk about them. I can almost guarantee it’ll lead to confusion. You could perhaps touch on them when you do Quadrature Encoders (which I notice aren’t in your curriculum).

Also, it might make more sense to have Program Flow above any sensor usage, especially when you use things like Whiles to explain PrintToScreen and DisplayLCD. Especially when you consider how fundamental Program Flow is programming, it might be important to make it Lesson 3.

Finally, I’m not an avid easyC user, but if you’re trying to make tutorials for someone who’s never really coded before, introducing them to Drag-n-Drop and traditional typing code, you might overwhelm them.

Otherwise, all the topics seem to be relevant and good.

I see what you mean. Program flow should definately be lesson two or three. There’s no way to easily explain sensors without that knowledge. We’ll switch that around.

We like IMEs, and we used them quite a lot last year. The main reason I wanted to teach that unit were the SmartMotorControl blocks that you can drive a robot with. It’s really easy to use. Thanks for pointing out I missed Quadrature Encoders, by the way. We don’t have any in our shop, and I sometimes forget that they’re out there.

The “User Code” was a really limited section in our minds. It was to show how to change the value of variables or do basic calculations, mainly. We’re not going super complicated here.

The goal of these lessons is just to give a basic understanding of how to write your own Autonomous and Joystick code. I’m tired of going to local competitions where only 1/3 of the teams have a working autonomous mode with sensors. We’re hoping that if we make the content accessible to everyone, the level of competition will increase.

Sounds Great!! Once you have the videos complete, may I share them on my web site?

http://simplerobotics.org/Programming.htm

We’re actually working out hosting for team’s website right now, where everything will be sorted and nicely organized. Most of our team is off for the summer, though, and those of us that are here are mostly just doing writing, design or background work. We’re not going to launch or do very much production for at least a few weeks.

If you wanted to include a link to our YouTube Channel once we get these up, though, that would be great!