Hi Everyone,
I've been working on this code for a while but I'm so confused on the errors if anyone can please help me fix the errors I will be forever thankful!
void setup() {
// put your setup code here, to run once:
#define trigpin 8
#define echopin 6
pinMode(trigpin, OUTPUT);
pinMode(echopin, INPUT);
int buttonPin = 8;
int buttonState = 0;
digitalWrite(trigpin, HIGH);
delay(50);
digitalWrite(trigpin, LOW);
unsigned long duration=pulseIn(echopin,HIGH);
int distance=(duration/2)/29.1;
#include <Servo.h>
Servo myservo;
myservo.attach(9);
myservo.writeMicroseconds(50);
myservo.write(90);
int val, potpin = 0;
val = analogRead(potpin);
val = map(val, 0, 1023, 0, 180);
pinMode(buttonPin, INPUT);
digitalWrite(buttonPin, HIGH);
#include <LiquidCrystal.h>
LiquidCrystal lcd (12, 11, 5, 4, 3, 2);
lcd.begin(16, 2);
lcd.clear();
lcd.print("Stay out!");
}
Door_opener.ino (783 Bytes)