Arduino Programming using Arduino IDE
-
Chapter-1->How to download Arduino IDE?3 Topics|1 Quiz
-
1.1 Introduction to Arduino IDE?
-
1.2 How to download Arduino IDE software?
-
1.3 Steps to install .exe file of Arduino IDE
-
1.1 Introduction to Arduino IDE?
-
Chapter-2-> Introduction to Arduino IDE3 Topics|1 Quiz
-
2.1 Why Arduino IDE?
-
2.2 How Arduino IDE works?
-
2.3 Explanation of default screen of Arduino IDE
-
2.1 Why Arduino IDE?
-
Chapter-3–> How to connect any board with Arduino IDE?4 Topics|1 Quiz
-
3.1 What are the different types of Arduino boards ?
-
3.2 What is USB cable?
-
3.3 Steps to connect board and port in Arduino IDE.
-
3.4 Advantages of Arduino IDE
-
3.1 What are the different types of Arduino boards ?
-
Chapter-4–>Steps to write a code in Arduino Programming5 Topics|1 Quiz
-
4.1 What is coding and C programming?
-
4.2 What is Arduino Programming?
-
4.3 Steps to write any code in Arduino IDE
-
4.4 How to open an example code in Arduino IDE
-
4.5 Explanation of different predefined syntax used in Arduino Programming?
-
Quiz-4->Steps to write a code in Arduino Programming
-
4.1 What is coding and C programming?
-
Chapter-5–>Introduction to Arduino Uno5 Topics|1 Quiz
-
5.1 What is Arduino and why we are using it?
-
5.2 Different types of Arduino boards
-
5.3 Explanation of Arduino UNO
-
5.4 Differentiate between digital and analog signals?
-
5.5 How to upload a code
-
5.1 What is Arduino and why we are using it?
-
Chapter-6–>Explanation of Variables and operators in programming5 Topics|1 Quiz
-
6.1 What are variables and data types?
-
6.2 What are operators?
-
6.3 Activity 1 : Led blink coding using Arduino IDE.
-
6.4 Activity 2 : Led on/ off using switch with arduino uno
-
6.5 How to upload the code
-
6.1 What are variables and data types?
-
Chapter-7–>How to use conditional statement and loops?6 Topics|1 Quiz
-
7.1 Introduction to loops and conditional statements.
-
7.2 Activity 3: Piano using Arduino Uno
-
7.3 Components Required
-
7.4 Circuit Connection
-
7.5 Coding using IDE
-
7.6 Compile and run
-
7.1 Introduction to loops and conditional statements.
-
Chapter-8–>How to use analog input in Arduino IDE ?6 Topics|1 Quiz
-
8.1 What are analog inputs and outputs ?
-
8.2 Activity 4: Controlling of Led using Potentiometer
-
8.3 Components Required
-
8.4 Circuit Connection
-
8.5 Coding using Arduino IDE
-
8.6 Compile and run
-
8.1 What are analog inputs and outputs ?
-
Chapter-9–>How to add libraries in Arduino IDE ?6 Topics|1 Quiz
-
9.1 What are libraries and header files?
-
9.2 Activity 5: Interfacing of Servo motor with Arduino Uno
-
9.3 Components Required
-
9.4 Circuit connection
-
9.5 Coding using Arduino IDE
-
9.6 Compile and run
-
9.1 What are libraries and header files?
-
Chapter-10–>How the Arduino Serial library performs serial communication?4 Topics|1 Quiz
-
10.1 What is Serial Communication?
-
10.2 How to do the serial communication in Arduino?
-
10.3 Activity 6: Interfacing of gas sensor with Arduino Uno and displaying amount of gas using serial communication
-
10.4 Compile and run
-
10.1 What is Serial Communication?
-
Chapter-11–>Interfacing of Dht11 sensor with Arduino4 Topics|1 Quiz
-
11.1 What is Dht11?
-
11.2 Activity7: Interfacing of DHT11 with Arduino Uno
-
11.3 Coding
-
11.4 Compile and run
-
11.1 What is Dht11?
-
Chapter-12–>Troubleshooting and Errors in Programming3 Topics|1 Quiz
-
12.1 What are Errors and Debugging?
-
12.2 Types of Errors
-
12.3 Common mistakes while Coding in Arduino IDE
-
12.1 What are Errors and Debugging?
-
Assessment6 Topics
-
Assignment 1-> Try to make a traffic light signal project.
-
Assignment 2-> Control the sequence of Led with potentiometer and Arduino Uno.
-
Assignment 3-> Distance measurement using Ultrasonic sensor and Arduino Uno
-
Assignment 4->Connect more push buttons in the Piano using Arduino Uno.
-
Assignment 5-> Alchohol detector using MQ-3 sensor and Arduino Uno.
-
Assignment-6-> Motion detector project using PIR sensor and Arduino UNO
-
Assignment 1-> Try to make a traffic light signal project.
Quizzes
9.5 Coding using Arduino IDE
23/09/2021
Coding :
To control the servo motor using Arduino Uno,first we have to code the circuit using Arduino IDE. As to code the servo motor, add the library of servo motor in Arduino IDE.Arduino IDE have in built library of servo, so add that library using the steps, as shown in the previous topic.Go to Sketch< Include library < Servo as shown in the below image:
Steps to do coding in Arduino IDE
1. Open Arduino IDE from the desktop.You will be see the following page when you will open Arduino IDE:
2. Now, clear the page open in Arduino IDE and then include the servo library.Next, we will define a variable named “servoPin” with integer data type to assign which pin we are using of Arduino UNO.
Expression :
#include
int servoPin = 9;
3. Now, Create a LIBRARY OBJECT FILE (.o) that is linked with programs which use servo library.
Expression :
Servo Servo1;
4. In void setup ( ) function, we need to attach the servo object with the servo pin which er have used.
Expression :
void setup()
{
// We need to attach the servo to the used pin number
Servo1.attach(servoPin);
}
4. In void loop() function, we write the main code and it run over and over again.first we will make the servo to move to 0 degree, then to 90 degree and then 180 degree.
Note: The servo goes to a specific position depending on the input signal, a continuous rotation servo either rotates clockwise or counter-clockwise at a speed proportional to the signal. For example, the Servo1.write(0) function will make the servomotor spin counter-clockwise at full speed. The Servo1.write(90) function will stop the motor and Servo1.write(180) will turn the motor clockwise at full speed.
Expression:
void loop(){
// Make servo go to 0 degrees
Servo1.write(0);
delay(1000);
// Make servo go to 90 degrees
Servo1.write(90);
delay(1000);
// Make servo go to 180 degrees
Servo1.write(180);
delay(1000);
}
Note : Lines mentioned in the “// ” are the comments.These comments are written for the explanation of program to programmer.
Complete Code:
#include
int servoPin = 9;
Servo Servo1;
void setup() {
Servo1.attach(servoPin);
}
void loop(){
Servo1.write(0);
delay(1000);
Servo1.write(90);
delay(1000);
Servo1.write(180);
delay(1000);
}