0% found this document useful (0 votes)
8 views2 pages

Coding and Lesson

The document provides an overview of coding and robotics, explaining key concepts such as coding instructions, frontend vs backend, algorithms, variables, if statements, loops, and functions. It also covers the basics of robotics, including components like sensors, actuators, and controllers, as well as programming concepts applied in robotics. Real-life examples illustrate how these concepts work in practice, such as in video games and robotic vacuum cleaners.

Uploaded by

martinmoepya07
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

Coding and Lesson

The document provides an overview of coding and robotics, explaining key concepts such as coding instructions, frontend vs backend, algorithms, variables, if statements, loops, and functions. It also covers the basics of robotics, including components like sensors, actuators, and controllers, as well as programming concepts applied in robotics. Real-life examples illustrate how these concepts work in practice, such as in video games and robotic vacuum cleaners.

Uploaded by

martinmoepya07
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Coding and Robotics Notes

1. Introduction to Coding

Coding is the process of writing instructions that tell a computer what to do and how to do it.
These instructions are written in programming languages that computers can understand.

2. Real-life Examples

Imagine you tell a friend to:


Wake up
Brush teeth
Wear uniform
Go to school
In GTA, missions have instructions you need to follow:
If followed correctly → mission passed
If not → mission failed
Bugs: Errors that show when the instructions you give the computer are wrong.

3. Frontend vs Backend

Frontend Backend
What users see and interact withWhat happens behind the scenes
Example: Login button Checks if your username & password are correct

4. Algorithm

A step-by-step set of instructions to solve a problem or complete a task.

5. Variables

Variables store information that can be used later in the program.


Example:

age = 15
name = "Martin"

6. If Statements

If statements let the program make decisions based on conditions.

if age >= 18:


print("You are an adult")
else:
print("You are a minor")

7. Loops

Loops repeat actions multiple times until a condition is met.

for i in range(5):
print("Hello", i)

8. Functions

Functions are reusable blocks of code that perform a specific task.

def greet(name):
print("Hello, " + name)

greet("Martin")

9. Robotics Basics
Robotics combines coding and hardware to make machines perform tasks automatically.
A robot is controlled by a program, which is written in a programming language.

Key Components of Robotics

1. Sensors – Detect the environment (e.g., distance sensors, light sensors).


2. Actuators – Motors or devices that make the robot move or act.
3. Controller – The “brain” of the robot (microcontroller or computer) that runs the program.
4. Power Supply – Battery or electricity source for the robot.

Robotics Programming Concepts

Variables – Store sensor readings or robot states.


If Statements – Make decisions based on sensor input.

if distance < 10:


stop()

Loops – Repeat actions like moving forward or checking sensors.

while True:
move_forward()
if obstacle_detected():
stop()
break

Functions – Reusable robot actions.

def turn_left():
motor_left.backward()
motor_right.forward()

Real-life Example

Imagine a robot vacuum cleaner:


Sensors detect walls and furniture
Loops make it move until the room is clean
If statements help it avoid obstacles

You might also like