Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrdecent08 authored Nov 23, 2020
1 parent 2f66398 commit 226ef19
Show file tree
Hide file tree
Showing 16 changed files with 671 additions and 0 deletions.
Binary file added Rotating a servo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions Rotating a servo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include <Servo.h>

int position = 0;

int i = 0;

int j = 0;

Servo servo_9;

void setup()
{
servo_9.attach(9);

}

void loop()
{
position = 0;
for (position = 1; position <= 179; position += 1) {
servo_9.write(position);
delay(20); // Wait for 20 millisecond(s)
}
for (position = 179; position >= 1; position -= 1) {
servo_9.write(position);
}
}
26 changes: 26 additions & 0 deletions Rotating servo pin using potentiometer.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <Servo.h>

int i = 0;

int j = 0;

int outputValue = 0;

int SensorValue = 0;

Servo servo_9;

void setup()
{
pinMode(A0, INPUT);
servo_9.attach(9);

}

void loop()
{
SensorValue = analogRead(A0);
outputValue = map(SensorValue, 0, 1023, 0, 180);
servo_9.write(outputValue);
delay(10); // Delay a little bit to improve simulation performance
}
Binary file added Rotating servo pin using potentiometer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
62 changes: 62 additions & 0 deletions Smart gate.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#include <Servo.h>
#include <Keypad.h>
Servo ServoMotor;

char* password = "123";

int position = 0;
const byte ROWS = 4;
const byte COLS = 4;
char keys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = { 8 , 7, 6, 5};
byte colPins[COLS] = { 4, 3, 2, 1 };
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

// Create two variables for LED Lights
int RedpinLock = 13;
int GreenpinUnlock = 12;
void setup()
{
pinMode(RedpinLock, OUTPUT);
pinMode(GreenpinUnlock, OUTPUT);
ServoMotor.attach(11);
LockedPosition(true);
}
void loop()
{
char key = keypad.getKey();
if (key == '*' || key == '#')
{
position = 0;
LockedPosition(true);
}
if (key == password[position])
{
position ++;
}
if (position == 3)
{
LockedPosition(false);
}
delay(100);
}
void LockedPosition(int locked)
{
if (locked)
{
digitalWrite(RedpinLock, HIGH);
digitalWrite(GreenpinUnlock, LOW);
ServoMotor.write(11);
}
else
{
digitalWrite(RedpinLock, LOW);
digitalWrite(GreenpinUnlock, HIGH);
ServoMotor.write(90);
}
}
Binary file added Smart gate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
86 changes: 86 additions & 0 deletions Social Distancing.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@

#include <Adafruit_NeoPixel.h>

int ledPin= 3;
int ledNo= 12;

Adafruit_NeoPixel strip= Adafruit_NeoPixel(ledNo,ledPin,NEO_RGB+NEO_KHZ800);


int buzzerPin= 10;
int echoPin= 8;
int trigPin= 2;
int minDistance = 100;
int maxDistance = 300;

void setup()
{
pinMode(buzzerPin, OUTPUT);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
Serial. begin(9600);
strip.begin();
for(int i = 0; i < ledNo; i++)
{
strip.setPixelColor(i,strip.Color(0,0,0));
}
strip.show();
}

void loop()
{
int distance = calcDistance();
Serial.println(distance);
int ledsToGlow = map(distance, minDistance, maxDistance, ledNo, 1);
Serial.println(ledsToGlow);
if(ledsToGlow == 12)
{
digitalWrite(buzzerPin, HIGH);
}
else
{
digitalWrite(buzzerPin, LOW);
}
for(int i = 0; i < ledsToGlow; i++)
{
if(i < 4)
{
strip.setPixelColor(i,strip.Color(50,0,0));//green,red,blue
}
else if(i >= 4 && i < 8)
{
strip.setPixelColor(i,strip.Color(50,50,0));//green,red,blue
}
else if(i >= 8 && i < 12)
{
strip.setPixelColor(i,strip.Color(0,50,0));//green,red,blue
}
}
for(int i = ledsToGlow; i < ledNo; i++)
{
strip.setPixelColor(i,strip.Color(0,0,0));
}
strip.show();
delay(50);
}

int calcDistance()
{
long distance,duration;
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = duration/29/2;
if(distance >= maxDistance)
{
distance = maxDistance;
}
if(distance <= minDistance)
{
distance = minDistance;
}
return distance;
}
Binary file added Social Distancing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Traffic lights.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions Traffic lights.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
void setup()
{
pinMode(9, OUTPUT);
pinMode(3, OUTPUT);
pinMode(2, OUTPUT);
}

void loop()
{
digitalWrite(9, HIGH);
digitalWrite(3, LOW);
digitalWrite(2, LOW);
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(9, LOW);
digitalWrite(3, HIGH);
digitalWrite(2, LOW);
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(9, LOW);
digitalWrite(3, LOW);
digitalWrite(2, HIGH);
delay(1000); // Wait for 1000 millisecond(s)
}
Binary file added blinking of light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions blinking of light.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
void setup()
{
pinMode(8, OUTPUT);
}

void loop()
{
digitalWrite(8, HIGH);
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(8, LOW);
delay(1000); // Wait for 1000 millisecond(s)
}
28 changes: 28 additions & 0 deletions operatingDCmotor.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
void setup()
{
pinMode(6,OUTPUT);
pinMode(5,OUTPUT);
pinMode(4,OUTPUT);
pinMode(3,OUTPUT);
}

void loop()
{
Forward();
delay(3000);
Backward();

}
void Forward(){
digitalWrite(6,HIGH);
digitalWrite(5,LOW);
digitalWrite(3,HIGH);
digitalWrite(4,LOW);
}

void Backward(){
digitalWrite(6,LOW);
digitalWrite(5,HIGH);
digitalWrite(3,LOW);
digitalWrite(4,HIGH);
}
Binary file added operatingDCmotor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added smart gate with lcd display.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 226ef19

Please sign in to comment.