Arduino
Arduino is a small yet mighty microcontroller board that serves as the brain for countless DIY projects. It's like the conductor of an orchestra, directing various electronic components to play together harmoniously. With its user-friendly interface and vast community support, Arduino makes it easy for anyone, regardless of their skill level, to bring their ideas to life and create interactive gadgets, robots, and more.
BLUETOOTH CONTROL CAR
Introducing our Arduino Bluetooth Control Car – a fun project that lets you drive a car with your smartphone! Using Arduino and Bluetooth, you can wirelessly control the car's movements. Just send commands like "forward" or "left" from your phone, and watch your car go! It's perfect for learning about electronics and programming while having a blast.
SOURCE CODE:
#include<AFMotor.h>
#define motor 10
#define Speed 250
char value;
int ledfront=12;
int ledback=11;
int buzzer=10;
AF_DCMotor M1(1);
AF_DCMotor M2(2);
AF_DCMotor M3(3);
AF_DCMotor M4(4);
void setup()
{
Serial.begin(9600);
pinMode(ledfront, OUTPUT);
pinMode(ledback, OUTPUT);
pinMode(buzzer, OUTPUT);
M1.setSpeed(Speed);
M2.setSpeed(Speed);
M3.setSpeed(Speed);
M4.setSpeed(Speed);
}
void loop()
{
Bluetoothcontrol();
}
void Bluetoothcontrol()
{
if(Serial.available()>0)
{
value=Serial.read();
Serial.println(value);
}
if(value=='F')
{
forward();
}
else if(value=='B')
{
backward();
}
else if(value=='L')
{
left();
}
else if(value=='R')
{
right();
}
else if(value=='S')
{
stop();
}
else if(value=='W')
{
digitalWrite(ledfront, HIGH);
}
else if(value=='w')
{
digitalWrite(ledfront, LOW);
}
else if(value=='U')
{
digitalWrite(ledback, HIGH);
}
else if(value=='u')
{
digitalWrite(ledback, LOW);
}
else if(value=='V')
{
digitalWrite(buzzer, HIGH);
}
else if(value=='v')
{
digitalWrite(buzzer, LOW);
}
}
void forward()
{
M1.run(FORWARD);
M2.run(FORWARD);
M3.run(FORWARD);
M4.run(FORWARD);
}
void backward()
{
M1.run(BACKWARD);
M2.run(BACKWARD);
M3.run(BACKWARD);
M4.run(BACKWARD);
}
void right()
{
M1.run(BACKWARD);
M2.run(BACKWARD);
M3.run(FORWARD);
M4.run(FORWARD);
}
void left()
{
M1.run(FORWARD);
M2.run(FORWARD);
M3.run(BACKWARD);
M4.run(BACKWARD);
}
void stop()
{
M1.run(RELEASE);
M2.run(RELEASE);
M3.run(RELEASE);
M4.run(RELEASE);
}
Automatic street light controller (using ldr)
"Automatic street light controller" in which the light intensity of street light control according to the intensity of the sun light.
Source code:
int ldr = A5;
int ldr_value;
int light=3;
void setup(){
pinMode(light,OUTPUT); //Bulb
pinMode(ldr,INPUT); // Ldr
}
void loop(){
ldr_value = analogRead(ldr);
if(ldr_value>512)
digitalWrite(light,LOW);// if there is sunlight light is off
else
digitalWrite(light,HIGH); // else on
}
Comments
Post a Comment