[go: up one dir, main page]

0% found this document useful (0 votes)
6 views35 pages

Workshop 1

The document provides an overview of Arduino, detailing its components, structure, and programming basics using the Arduino IDE. It also introduces TinkerCAD for simulating electronic circuits and includes examples of simple projects like an LED and a traffic light circuit. Additionally, it highlights India's successful Chandrayaan-3 mission as a significant achievement in space exploration.

Uploaded by

dewiba7989
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)
6 views35 pages

Workshop 1

The document provides an overview of Arduino, detailing its components, structure, and programming basics using the Arduino IDE. It also introduces TinkerCAD for simulating electronic circuits and includes examples of simple projects like an LED and a traffic light circuit. Additionally, it highlights India's successful Chandrayaan-3 mission as a significant achievement in space exploration.

Uploaded by

dewiba7989
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
You are on page 1/ 35

Robotics

Workshop-1

ROBOTICS CLUB NITP


Arduino
(General Instruction)
● An Arduino is an open-source microcontroller
development board.

● This allows us to upload programs to this board which


can then interact with things in the real world.

● Basically, if there is something that is in any way


controlled by electricity, the Arduino can interface with
it in some manner. And even if it is not controlled by
electricity, one can probably still use things which are
(like motors and electromagnets), to interface with it.
Some common types of Arduino board :

Arduino UNO R3 Arduino Nano Arduino Mega

Arduino UNO
Basic Structure
of Arduino UNO
• Microcontroller: Microcontroller is the main component of Arduino Uno. The
Arduino Uno board is a microcontroller based on the ATmega328.
• 14 Digital Pins: Arduino Uno Consist of 14 Digital Pins Where output Components
like: LED, LCD, Relay etc. are connected. These work for a value of HIGH or LOW.
• Analog Pins: Arduino Uno Consist of 6 Analog Pins, Analog Pins are usually used to
connect sensor like: IR Sensor , RF Sensor these all sensor have analog value that’s
why they are connected to analog pins, Most of the input components are
connected here. These pins return a value of 0-255.
• PWM – The pulse width modulation pins marked with the (~) symbol can simulate
analog output
• Reset Button: This is used to start the programme again which is once uploaded.
• Voltage Regulator:The function of the voltage regulator is to control the voltage
given to the Arduino board and stabilize the DC voltages used by the processor
and other elements.
• Crystal Oscillator:The crystal oscillator helps Arduino in dealing with time issues.
How does Arduino calculate time? The answer is, by using the crystal oscillator.
The number printed on top of the Arduino crystal is 16.000H9H. It tells us that
the frequency is 16,000,000 Hertz or 16 MHz.
• Power LED indicator:This LED should light up when you plug your Arduino into a
power source to indicate that your board is powered up correctly. If this light
does not turn on, then there is something wrong with the connection.
• Built-in LED: This LED is internally connected to I/O pin 13 of Arduino uno and
lights up when commanded on pin 13.
• Power Supply: The power supply pins are Vin, 5V, 3.3V, GND, IOREF are used to
power Input and output components. The recommended range is 7 to 12 volts to play
your board safe.
• Power Jack: Arduino board can be powered either by USB connection or with an
external power supply. This is used to power the Arduino board where we connect a
dc source from 7-12 volts.
• USB Port: This port function to programme the board or to upload the programme.
The one end of USB cable is connected to the laptop and another to this port. With
help of Arduino software and USB cable, one can upload the programme on the
board.
Arduino IDE
Arduino IDE:
● The Arduino language is C++ thus it is a
case sensitive language.
● Most of the time, people will use a small
subset of C++, which looks a lot like C.
If you are familiar with Java, then you
will find C++ easy to work with and to
recognize.
● The simplest possible Arduino sketch is
this
What are variables?
● name of the memory location. It is used to store data.Its value can be changed, and it can be reused
many times.

● int a=10,b=20;//declaring 2 variable of integer type


float f=20.8;
char c='A';

● A variable can have alphabets, digits, and underscore.


● A variable name can start with the alphabet, and underscore only. It can't start with a digit.
● No whitespace is allowed within the variable name.
● A variable name must not be any reserved word or keyword, e.g. int, float, etc.
Data Types

A data type is an attribute


associated with a piece of data that
tells a computer system how to
interpret its value.
Data Type Definition Examples

Integer (int) Numeric data type for numbers without fractions -707, 0, 707

Floating Point (float) Numeric data type for numbers with fractions 707.07, 0.7, 707.00

Boolean (bool) True or false values 0 (false), 1 (true)

Array List with a number of elements in a specific order—typically of the same type rock (0), jazz (1), blues (2),
pop (3)

Character (char) Single letter, digit, punctuation mark, symbol, or blank space a, 1, !

String (str or text) Sequence of characters, digits, or symbols—always treated as text hello, +1-999-666-3333
Why we need function?
void checkTriangle(int x1, int y1, int x2, int y2, int x3, int y3)
{

// Calculation the area of


// triangle. We have skipped
// multiplication with 0.5
// to avoid floating point
// computations
int a = x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2);

// Condition to check if
// area is not equal to 0
if (a == 0)
cout << "No";
else
cout << "Yes";
}
Function
The function is a block of statement
or instruction enclosed by curly
braces { } that together perform one
of the special tasks
Basic syntax of function
return_type function_name (parameter list){
//function body
return (expression)
}

return_type: Return type can be of any data type such as int, double, char, void, short etc.

function_name: It can be anything.

argument list: Argument list contains variables names along with their data types. These arguments are
kind of inputs for the function. For example – A function which is used to add two integer variables, will
be having two integer argument.

Block of code: Set of statements, which will be executed whenever a call will be made to the function.
Example
If-else
statement
● If else Statement in C programming
language, when we need to execute a block
of statements that too when a particular
condition is met or not met that situation is
known as decision making.
● In C programming, the decision-making
process is used to specify certain orders in
which statements are executed.
Basic syntax of if-else statement
Example
int marks=75
if(marks<=40){
print(“You are fail”)
}
if(40<marks<=50){
print(“You got D grade”) Output:
}
else if(50<marks<=60){ You got A grade
print(“You got C grade”)
}
else if(60<marks<=70){
print(“You got B grade”)
}
else if(70<marks<=80){
print(“You got A grade”)
}
else {
print(“You got A+”)
Basic structure of for loop
for(initialization; test Expression; increment/decrement)
{
Body of Loop
}

initialization: this allows you to initialize the initial value for the loop control.

test expression: This is for testing the condition. If the condition satisfies enter into the for loop
body and execute the code of for loop.

increment/decrement: This is for increments or decrements of the value of the variable each
time after the execution of the for loop body.
Setting up Arduino IDE :
● Step-1: Go to https://www.arduino.cc/ or just search download Arduino IDE on google
● Step-2: Install the latest version of Arduino IDE according to your system.
● Step-3: Install the IDE by leaving everything as default.
● Step-4: Open the IDE.
● Click on verify button.
● Click on upload button.

● After the uploading is successful the terminal shows the message Done Uploading and you will
see the led on your board blinking at interval of 1 sec.

● If any error or Warning arises it shows them too.


TinkerCAD
TinkerCAD
● Tinkercad is a free web app for 3D design, electronics, and coding.
● We generally use TinkerCAD to simulate electronic circuits.

Getting Started with TinkerCAD

● First go to
https://www.tinkercad.com/
and create a student account.
● Now click on new button and
then select Circuit.
● A new blank project starts.
01

TinkerCAD
Project 1
Basic LED Project
What we are working on

Arduino UNO LED Digital Pins


Code:
void setup(){
pinMode(13, OUTPUT);
}

void loop(){
digitalWrite(13, HIGH);
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(LED_BUILTIN, LOW);
delay(1000); // Wait for 1000 millisecond(s)
}
01

TinkerCAD
Project 2
A simple traffic light circuit
What we are working on

Arduino UNO LED Digital Pins


Code:
void setup(){
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
}
void loop(){
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(100);
digitalWrite(12, HIGH);
delay(300);
digitalWrite(12, LOW);
delay(100);
digitalWrite(11, HIGH);
delay(1000);
digitalWrite(11, LOW);
delay(100);
}
India's Chandrayaan-3:
A Giant Leap to the Moon
The successful landing of Chandrayaan-3 was a big
win for India in space exploration. It's like when a
spaceship lands perfectly on the moon. This mission
used really smart technology and was super accurate.

Chandrayaan-3 followed another mission and had the


best equipment and landing tools. It showed that
India can do tricky stuff in space.

This success also matched the user's goals, as it was


a huge step for India's space dreams. People from all
over the world praised it, and it made India even
better at space stuff.

Lots of planning and hard work made this happen. It


showed that India wants to learn more about space
and do cool things there. It's a big thumbs up to the
smart people who made it work!

You might also like