Write a program to simulate a gate barrier system. Use the following program flow: 1. Gate is in an idle state waiting for a car 2. If a car is present, the gate will open as shown in the figure. 3. The gate will stay open for 5sec. If there is not a car present, the gate will close. 4. While closing, if a car arrives the gate will immediately return to the opening mode. You should use PCO to simulate the sensor that detects the cars. A '1' at PCO simulates a car present and a '0' represents the absence of a car. Make sure to enable pullup resistors on PCO and use bitmasking to read its value. PCO or pin 37 Wire Car not present PCO or pin 37 Not Connected +5 V Car present Wire PCO or pin 37 Connected to +5 V Close Open For the gate, you will

Introductory Circuit Analysis (13th Edition)
13th Edition
ISBN:9780133923605
Author:Robert L. Boylestad
Publisher:Robert L. Boylestad
Chapter1: Introduction
Section: Chapter Questions
Problem 1P: Visit your local library (at school or home) and describe the extent to which it provides literature...
icon
Related questions
Question

Please help! Using stepper motor, and arduino mega.

Write a program to simulate a gate barrier system. Use the following program flow:
1. Gate is in an idle state waiting for a car
2. If a car is present, the gate will open as shown in the figure.
3. The gate will stay open for 5sec. If there is not a car present, the gate will close.
4. While closing, if a car arrives the gate will immediately return to the opening mode.
You should use PCO to simulate the sensor that detects the cars.
A '1' at PCO simulates a car present and a '0' represents the absence of a car.
Make sure to enable pullup resistors on PCO and use bitmasking to read its value.
PCO or pin 37
Wire
Car not present
PCO or pin 37
Not Connected
+5 V
PCO or pin 37
Connected to +5 V
Car present
Wire
Close
-
Open
For the gate, you will
Transcribed Image Text:Write a program to simulate a gate barrier system. Use the following program flow: 1. Gate is in an idle state waiting for a car 2. If a car is present, the gate will open as shown in the figure. 3. The gate will stay open for 5sec. If there is not a car present, the gate will close. 4. While closing, if a car arrives the gate will immediately return to the opening mode. You should use PCO to simulate the sensor that detects the cars. A '1' at PCO simulates a car present and a '0' represents the absence of a car. Make sure to enable pullup resistors on PCO and use bitmasking to read its value. PCO or pin 37 Wire Car not present PCO or pin 37 Not Connected +5 V PCO or pin 37 Connected to +5 V Car present Wire Close - Open For the gate, you will
sketch_feb8a | Arduino DE 2.3.0
File Edit Sketch Tools Help
lik
O
sketch_feb8a.ino
1
CEEEEEEEEEEEN
10
11
12
21
22
23
24
25
int fullsteps [4] (Obl, Ob1000, 0b10, 0b100);
int i = 0;
Arduino Mega or Meg...
void setup() {
// put your setup code here, to run once:
DDRA = 0XFF;
}
void loop() {
// put your main code here, to run repeatedly:
PORTA = fullsteps [i%4];
delay(5)
i++;
// go to a desired angle
if( curPos < desPos) {
}
I
curPos ++;
PORTA = fullsteps [curPos%4];
delay(?);
}
Transcribed Image Text:sketch_feb8a | Arduino DE 2.3.0 File Edit Sketch Tools Help lik O sketch_feb8a.ino 1 CEEEEEEEEEEEN 10 11 12 21 22 23 24 25 int fullsteps [4] (Obl, Ob1000, 0b10, 0b100); int i = 0; Arduino Mega or Meg... void setup() { // put your setup code here, to run once: DDRA = 0XFF; } void loop() { // put your main code here, to run repeatedly: PORTA = fullsteps [i%4]; delay(5) i++; // go to a desired angle if( curPos < desPos) { } I curPos ++; PORTA = fullsteps [curPos%4]; delay(?); }
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Diode-Transistor Logic Circuit
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, electrical-engineering and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Introductory Circuit Analysis (13th Edition)
Introductory Circuit Analysis (13th Edition)
Electrical Engineering
ISBN:
9780133923605
Author:
Robert L. Boylestad
Publisher:
PEARSON
Delmar's Standard Textbook Of Electricity
Delmar's Standard Textbook Of Electricity
Electrical Engineering
ISBN:
9781337900348
Author:
Stephen L. Herman
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Electrical Engineering
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education
Fundamentals of Electric Circuits
Fundamentals of Electric Circuits
Electrical Engineering
ISBN:
9780078028229
Author:
Charles K Alexander, Matthew Sadiku
Publisher:
McGraw-Hill Education
Electric Circuits. (11th Edition)
Electric Circuits. (11th Edition)
Electrical Engineering
ISBN:
9780134746968
Author:
James W. Nilsson, Susan Riedel
Publisher:
PEARSON
Engineering Electromagnetics
Engineering Electromagnetics
Electrical Engineering
ISBN:
9780078028151
Author:
Hayt, William H. (william Hart), Jr, BUCK, John A.
Publisher:
Mcgraw-hill Education,