ARIEL NUNES BRAZ GOMESFernando F de Carvalho
Published

Sensor for parking spaces V2

A parking sensor made with Arduino and Neopixel !

BeginnerFull instructions provided1 hour500
Sensor for parking spaces V2

Things used in this project

Story

Read more

Schematics

Sensor for parking spaces V2 Scheme

made on https://www.tinkercad.com

Code

Sensor for parking spaces V2

Arduino
I use 3 librarys, 2 for LCD and 1 for NeoPixel.
#include <LiquidCrystal.h>
#include <Adafruit_NeoPixel.h>

#define numLeds 1
#define pinNumber 6

#define TRIGGER_1 8
#define ECHO_1 7

Adafruit_NeoPixel pixels = Adafruit_NeoPixel (numLeds, pinNumber, NEO_GRB + NEO_KHZ800);

LiquidCrystal lcd(12, A5, A4, A3, A2, A1);

//Ultrasonic sensor_L(10, 9);
//Ultrasonic sensor_R(8, 7);

unsigned long temp = 0;
float distancia = 0;

void setup() {
  
  pinMode(ECHO_1, INPUT); //Pino ECHO de saída
  pinMode(TRIGGER_1, OUTPUT); //Pino TRIGGER de entrada
  
  pixels.begin();
  lcd.begin(16, 2);
  lcd.clear();
  
}

void loop() {
  
  digitalWrite(TRIGGER_1, HIGH);
  delayMicroseconds(10);
  digitalWrite(TRIGGER_1, LOW);
  
  temp = pulseIn(ECHO_1, HIGH, 20588);
  
  distancia = temp/58.0;
  
  if(distancia<10.0){
    lcd.print("VAGA - LIVRE");
    pixels.setPixelColor(0,pixels.Color(0, 255, 0));
  }
  else{
    lcd.print("VAGA - OCUPADA");
    pixels.setPixelColor(0,pixels.Color(255, 0, 0));
  }
  
  delay(500);
  lcd.clear();
  pixels.show();
  
  
}
 

Credits

ARIEL NUNES BRAZ GOMES

ARIEL NUNES BRAZ GOMES

3 projects • 2 followers
Amante da tecnologia e louco por café. Sou um estudante com um brilho especial no olhar, aberto a diálogo e com sede de conhecimento.
Fernando F de Carvalho

Fernando F de Carvalho

20 projects • 8 followers
Thanks to Othon Gonzaga.

Comments