Dante Roumega
Published © GPL3+

Voice Activated Arduino Blinds

I think adding Bluetooth to everything in my life has become a problem, I'm working on it.

BeginnerFull instructions provided2.5 hours8,387
Voice Activated Arduino Blinds

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Code

Bluetooth code

Arduino
upen using the arduino IDE
int brightness = 0; 
int fadeAmount = 5; 
int led = 3;
int inPin = 4;
int inPin2 = 7;
int val2 = 0;
int val = 0; 
const int motorPin1  = 11;  
const int motorPin2  = 10; 
const int motorPin3  = 8;  
const int motorPin4  = 9; 
int state; int flag=0;
void setup()
{
 pinMode(motorPin1, OUTPUT);
  pinMode(motorPin2, OUTPUT);
    pinMode(motorPin3, OUTPUT);
    pinMode(motorPin4, OUTPUT);
  pinMode(inPin, INPUT); 
    pinMode(inPin2, INPUT); 
   pinMode(led, OUTPUT);
Serial.begin(9600);
delay(1000); }

void loop(){
  
  analogWrite(led, brightness);
   brightness = brightness + fadeAmount;
   
   if (brightness <= 0 || brightness >= 255) {
    fadeAmount = -fadeAmount;
  }
  delay(30);

val = digitalRead(inPin);
val2 = digitalRead(inPin2);


if(Serial.available() > 0)

{

state = Serial.read();

flag=0;

} 

if (state == 'U' || val == LOW)

{

digitalWrite(motorPin1, HIGH);
digitalWrite(motorPin2, HIGH);
digitalWrite(motorPin3, HIGH);
digitalWrite(motorPin4, HIGH);
delay(2000);
digitalWrite(motorPin1, 0);
digitalWrite(motorPin2, 0);
digitalWrite(motorPin3, 0);
digitalWrite(motorPin4, 0);
Serial.println("Both Up");
state = 0;
}

else if (state == 'D' || val2 == LOW)
{

digitalWrite(motorPin1, HIGH);
digitalWrite(motorPin2, 0);
digitalWrite(motorPin3, 0);
digitalWrite(motorPin4, HIGH);
delay(2000);
digitalWrite(motorPin1, 0);
digitalWrite(motorPin2, 0);
digitalWrite(motorPin3, 0);
digitalWrite(motorPin4, 0);

Serial.println("Both Down");
state = 0;
}
if (state == 'W')

{

digitalWrite(motorPin1, HIGH);
digitalWrite(motorPin2, HIGH);
delay(2000);
digitalWrite(motorPin1, 0);
digitalWrite(motorPin2, 0);
Serial.println("Right Up");
state = 0;
}

else if (state == 'L')
{

digitalWrite(motorPin1, HIGH);
digitalWrite(motorPin2, 0);
delay(2000);
digitalWrite(motorPin1, 0);
digitalWrite(motorPin2, 0);

Serial.println("Right Down");
state = 0;
}
if (state == 'K')

{

digitalWrite(motorPin3, HIGH);
digitalWrite(motorPin4, HIGH);
delay(2000);
digitalWrite(motorPin3, 0);
digitalWrite(motorPin4, 0);
Serial.println("Left Up");
state = 0;
}

else if (state == 'I')
{

digitalWrite(motorPin3, 0);
digitalWrite(motorPin4, HIGH);
delay(2000);
digitalWrite(motorPin3, 0);
digitalWrite(motorPin4, 0);

Serial.println("Left Down");
state = 0;
}
}

Credits

Dante Roumega

Dante Roumega

14 projects • 117 followers
Im 19 and I love electrical engineering

Comments