SlideShare a Scribd company logo
robotics presentation for a club you run
ESP32
Led blink
LED blink Code
#define led 2
void setup() {
// put your setup code here, to run once:
pinMode(led,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(led,HIGH);
delay(1000);
digitalWrite(led,LOW);
delay(1000);
}
Ultrasonic
const int trigPin = 2;
const int echoPin = 4;
float duration, distance;
void setup() {
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
Serial.begin(9600);
}
void loop() {
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration*.0343)/2;
Serial.print("Distance: ");
Serial.println(distance);
delay(100);
}
LINE follower car
#define irPin1 2
#define irPin2 4
#define motorPin1 18
#define motorPin2 19
#define motorPin3 22
#define motorPin4 23
void setup() {
pinMode(irPin1,INPUT);
pinMode(irPin2,INPUT);
Serial.begin(9600);
pinMode(motorPin1,OUTPUT);
pinMode(motorPin2,OUTPUT);
pinMode(motorPin3,OUTPUT);
pinMode(motorPin4,OUTPUT);
}
void loop() {
if(irPin1){
Left();
}
else if(irPin2){
Right();
}
else if(irPin1 && irPin2){
Forward();
}
else{
Stop();
}
}
void Forward(){
digitalWrite(motorPin1,1);
digitalWrite(motorPin2,0);
digitalWrite(motorPin3,1);
digitalWrite(motorPin4,0);
}
void Left(){
digitalWrite(motorPin1,0);
digitalWrite(motorPin2,0);
digitalWrite(motorPin3,1);
digitalWrite(motorPin4,0);
}
void Right(){
digitalWrite(motorPin1,1);
digitalWrite(motorPin2,0);
digitalWrite(motorPin3,0);
digitalWrite(motorPin4,0);
}
void Stop(){
digitalWrite(motorPin1,0);
digitalWrite(motorPin2,0);
digitalWrite(motorPin3,0);
digitalWrite(motorPin4,0);
}
Bluetooth Car
#include "BluetoothSerial.h"
BluetoothSerial SerialBT;
char receivedChar;// received value will be stored as CHAR in this
variable
#define Motor_Pin1 23
#define Motor_Pin2 22
#define Motor_Pin3 19
#define Motor_Pin4 18
void setup() {
Serial.begin(9600);
SerialBT.begin("Team 2"); //type your team number
pinMode(Motor_Pin1,OUTPUT);
pinMode(Motor_Pin2,OUTPUT);
pinMode(Motor_Pin3,OUTPUT);
pinMode(Motor_Pin4,OUTPUT);
}
void loop() {
if (SerialBT.available()) {
receivedChar = SerialBT.read();
Serial.print ("Received:");//print on serial monitor
Serial.println(receivedChar);//print on serial monitor
if(receivedChar == 'F')
{
Forward();
}
if(receivedChar == 'B')
{
Back();
}
if(receivedChar == 'L')
{
Left();
}
if(receivedChar == 'R')
{
Right();
}
if(receivedChar == 'S')
{
Stop();
}
}
delay(20);
}
void Forward(){
digitalWrite(Motor_Pin1,1);
digitalWrite(Motor_Pin2,0);
digitalWrite(Motor_Pin3,1);
digitalWrite(Motor_Pin4,0);
}
void Left(){
digitalWrite(Motor_Pin1,0);
digitalWrite(Motor_Pin2,0);
digitalWrite(Motor_Pin3,1);
digitalWrite(Motor_Pin4,0);
}
void Right(){
digitalWrite(Motor_Pin1,1);
digitalWrite(Motor_Pin2,0);
digitalWrite(Motor_Pin3,0);
digitalWrite(Motor_Pin4,0);
}
void Stop(){
digitalWrite(Motor_Pin1,0);
digitalWrite(Motor_Pin2,0);
digitalWrite(Motor_Pin3,0);
digitalWrite(Motor_Pin4,0);
}
void Back(){
digitalWrite(Motor_Pin1,0);
digitalWrite(Motor_Pin2,1);
digitalWrite(Motor_Pin3,0);
digitalWrite(Motor_Pin4,1);
}
Search Arduino Iot Cloud
Click On Arduino
Cloud -Home Page
Click On Get Started
Click On Sign In
Click On Iot Cloud
Click On Create Thing
Click On Add Variable
Write led in name
Select bool in Declaration
Click on Read & Write
Click on “on change”
Click on Add Variable
Click On Select Device
Click On Set Up new
Device
Click On Set up a
3rd party device
Click On ESP32
Search v1 and Select DOIT ESP32
Click On Continue
Write any name
Click On Done
Click On Dashboards
Click On BUILD
DASHBOARD
Click On ADD
Click On Switch
Click On Link Variable
Click On led
Click On Link Variable
Click On Done
#include <ArduinoIoTCloud.h>
#include <Arduino_ConnectionHandler.h>
#define ledPin 2
const char DEVICE_LOGIN_NAME[] = ""; //enter your device login name from pdf
const char DEVICE_KEY[] = ""; // enter your device key from pdf
const char SSID[] = ""; //enter your mobile hotspot name
const char PASS[] = ""; //enter your hotspot password
bool led;
bool status = false;
void onLedChange();
WiFiConnectionHandler ArduinoIoTPreferredConnection(SSID, PASS);
void setup() {
Serial.begin(9600);
initProperties();
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
pinMode(ledPin,OUTPUT);
}
void loop() {
ArduinoCloud.update();
if(!status){
if(ArduinoCloud.connected()){
digitalWrite(ledPin,HIGH);
delay(5000);
digitalWrite(ledPin,LOW);
status=true;
}
}
}
void onLedChange() {
if(led==true){
digitalWrite(ledPin,HIGH);
Serial.write("led on");
}
else{
digitalWrite(ledPin,LOW);
Serial.write("led off");
}
}
void initProperties(){
ArduinoCloud.setBoardId(DEVICE_LOGIN_NAME);
ArduinoCloud.setSecretDeviceKey(DEVICE_KEY);
ArduinoCloud.addProperty(led, READWRITE, ON_CHANGE, onLedChange);
}
Copy Device ID
Paste Device ID
Copy Secret Key
Paste Key
Enter hotspot name and pass.
Click on Library manager
Search ArduinoIot
Install ArduinoIoTCloud.h
Install Arduino_ConnectionHandler.h
Upload The Code

More Related Content

DOCX
IOT excercise ESP32 Simulation projects.docx
PPTX
IoT Platform
PPTX
IoT Platform
PPTX
Internet of Things (IoT) reference architecture using Azure -MIC - Lahore
PPTX
Microsoft's view of the Internet of Things (IoT) by Imran Shafqat
KEY
Scottish Ruby Conference 2010 Arduino, Ruby RAD
PDF
Esp8266 v12
PDF
NodeMCU 0.9 Manual using Arduino IDE
IOT excercise ESP32 Simulation projects.docx
IoT Platform
IoT Platform
Internet of Things (IoT) reference architecture using Azure -MIC - Lahore
Microsoft's view of the Internet of Things (IoT) by Imran Shafqat
Scottish Ruby Conference 2010 Arduino, Ruby RAD
Esp8266 v12
NodeMCU 0.9 Manual using Arduino IDE

Similar to robotics presentation for a club you run (20)

PDF
WIFI ESP01 interfacing with Arduino UNO with Sensor DHT11
PPT
IoT Basics with few Embedded System Connections for sensors
PPTX
Arduino_cloud.pptx
PDF
Iot for smart agriculture
PDF
NodeMCU ESP8266 workshop 1
PDF
An introduction to Arduino
PDF
IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...
PPTX
IoT Hands-On-Lab, KINGS, 2019
PPTX
IOT beginnners
PPTX
IOT beginnners
PPTX
INTODUCTION OF IOT AND INTERFACING WITH ARDUINO UNO
PDF
Smart Projects With Arduino And Esp32 Integrating Artificial Intelligence Abd...
PPTX
IOT Talking to Webserver - how to
PDF
Let's begin io t with $10
PPTX
Computer networks unit III CHAPTER of frameworks
PDF
Arduino uno basic Experiments for beginner
PPT
IoT with Arduino
PPTX
Intel galileo gen 2
PDF
Introduction of Arduino Uno
PDF
ESP32 WiFi & Bluetooth Module - Getting Started Guide
WIFI ESP01 interfacing with Arduino UNO with Sensor DHT11
IoT Basics with few Embedded System Connections for sensors
Arduino_cloud.pptx
Iot for smart agriculture
NodeMCU ESP8266 workshop 1
An introduction to Arduino
IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...
IoT Hands-On-Lab, KINGS, 2019
IOT beginnners
IOT beginnners
INTODUCTION OF IOT AND INTERFACING WITH ARDUINO UNO
Smart Projects With Arduino And Esp32 Integrating Artificial Intelligence Abd...
IOT Talking to Webserver - how to
Let's begin io t with $10
Computer networks unit III CHAPTER of frameworks
Arduino uno basic Experiments for beginner
IoT with Arduino
Intel galileo gen 2
Introduction of Arduino Uno
ESP32 WiFi & Bluetooth Module - Getting Started Guide
Ad

Recently uploaded (20)

PPTX
Lecture Notes Electrical Wiring System Components
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
web development for engineering and engineering
PDF
composite construction of structures.pdf
PPTX
Construction Project Organization Group 2.pptx
DOCX
573137875-Attendance-Management-System-original
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PDF
Well-logging-methods_new................
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
Welding lecture in detail for understanding
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Lecture Notes Electrical Wiring System Components
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Operating System & Kernel Study Guide-1 - converted.pdf
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
R24 SURVEYING LAB MANUAL for civil enggi
web development for engineering and engineering
composite construction of structures.pdf
Construction Project Organization Group 2.pptx
573137875-Attendance-Management-System-original
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
Well-logging-methods_new................
UNIT-1 - COAL BASED THERMAL POWER PLANTS
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Welding lecture in detail for understanding
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Ad

robotics presentation for a club you run