Arduino Tutorials

Here is the link to Arduino Lessons, Codes, and Libraries

Welcome to Arduino Tutorials.

Arduino Basic

Here is the Arduino Code and Circuit for a Flashing Lights using TinkerCAD

Arduino LED Experiment Tutorial

Arduino Moisture Sensor Tutorial

Let us Challenge you with Traffic Signal Arduino Project. Download the project rubric.

Arduino – Ultrasonic Sensor

Copy the Arduino Code for Ultrasonic Sensor for 3 LED Lights.

const int trigPin=13;
const int echoPin=12;
const int led=11;
const int led2=10;
const int led3=9;

void setup()
{ Serial.begin (9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(led, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
}
void loop()
{ long duration, distance;
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.5;
if (distance < 30)
{ digitalWrite(led,HIGH);
if (distance < 20)
{ digitalWrite(led2,HIGH);
if (distance < 10)
{ digitalWrite(led3,HIGH);
}
}
}
else {
digitalWrite(led,LOW);
digitalWrite(led2,LOW);
digitalWrite(led3,LOW);
}
Serial.println(distance);
delay(2000);
}

Arduino – Joystick

Here is the Arduino Code for Joystick, Vrx

void setup() {
// put your setup code here, to run once:
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
Serial.begin(9600);
}

void loop() {
// put your main code here, to run repeatedly:
int vrx=analogRead(A0);
Serial.println(vrx);
delay(50);

if(vrx<502)
{
digitalWrite(3,HIGH);
digitalWrite(4,LOW);
}
else
{
digitalWrite(3,LOW);
digitalWrite(4,HIGH);
}
}