
Explore the NXC compiler and related software to code a Lego robot, compile your program, connect to the brick, download and run it, and even control it via joystick.
Learn to display a hello world message on the robot's screen using a simple C function, set text position and wait time, and compile and upload via USB.
Master Lego robot programming in C by controlling motors on ports A and C, setting power to 75, and driving forward or backward.
Execute forward and backward movements, then practice turning by driving with one or both motors at adjustable power to achieve a 90-degree turn, using timing to control duration.
Learn to use c-like programming to control a Lego robot, driving a square with timed left-right engine calls, compiling and uploading via ISP cable.
Program a Lego robot in C to read the touch sensor, using ports and cables, and implement a loop that drives forward, stops on touch, and backs up briefly.
Learn to use an ultrasonic sensor to measure distance by timing send and receive events, and loop to drive forward or turn based on a distance threshold.
Use atlas and assessor to auto search for enemies within 25 centimeters, rotate to face them, move toward the target, and attack or destroy as needed while continually scanning.
Learn how to drive with forward synchronized control, where left and right motors run in sync at the same time, with zero meaning equal speed for straight lines or turns.
Learn how a pid controller uses proportional, integral, and derivative terms to minimize position error and adjust motor power in real time for precise square turns.
Learn to program LEGO robots in C by creating snake-like motions with synchronized motors, curves, and turns, using functions to control power, timing, and simple multitasking.
Course Description
The course teaches you how to use the C programming to control the LEGO Robot. It is not the NXT software but more cool NXC coding. You can learn the basic C coding skill and special function for the LEGO Robot. You can develop an algorithm to let your Robot auto pilot the field and find enemies.
Build a strong foundation for beginner for the C coding and hardware control.
Learn the function definition.
How to use parameter.
Loop control, while, repeat and If else.
Hardware IO control.
Advanced function like PID controller.
Synchronize the two wheels.
A powerful skill to learn
C is the basic language for a lot of coding projects. It also share very similar grammar with all other advanced coding language. Through the classes, you could learn the C basic format and the essential functions like the while loop, if/else control. It open the door to beginner.
The classes also teach how the C code connect to the hardware through the input/output (I/O) ports. After compiling, the C code could translate to lower level language to read and write the hardware IO and then control the Robot.
Through the I/O interface, the sensor could send feedback information back to Robot processor. So you could write an algorithm to control the Robot based on what it sees.
The two Robot motors are controlled by the I/O. You could learn how to control the motor from basic speed control and motor rotate control. A classic PID control could be implemented to speed up the response. A synchronous control could guide the Robot to move in a straight line or in a specified curve.
Content and overview
First, you will learn how to download the software compiler and how to use it to compile the code and download to LEGO Robot.
Second, you learn the basic coding to send a message to Robot screen. You can see how the computer talk to your Robot. By using basic function like repeat and while loop, if/else functions, you could move the Robot and make it turns.
After learned the coding basic, you could use the coding to control the sensors like touch sensor and ultra sound sensor. Using the sensors allow you to control the Robot to achieve your tasks. I show you an example the Robot will search enemies in the filed and attack it.
More complicated function will also be taught. The PID control will control the Robot precisely. The synchronous control will control the two wheel in phase or has a phase shift. By using the function, the Robot could move straight line or circle or a curve.
All of these could be done using the coding. It reveals a new fun world for the LEGO Robot. It does much more than self contained NXT software.