Question

design a C++ program that make use to embedded in a Arduino micro controller. that will...

design a C++ program that make use to embedded in a Arduino micro controller. that will control a conveyor belt. the program must be able to start and stop the conveyor belt. should have 3 led light on it.( red led is used when conveyor is running) (yellow led is when conveyor is about to move must blink 10 times and should sound a beeping alarm) (green is when conveyor is stop) you also have to add a Start and stop button and a emergency push button. the program must include a proximity sensor to stop conveyor so that the robotic amartron will pick up package. also this conveyor system should work off wifi to remote start and stop the conveyor.

Homework Answers

Answer #1

A C++ program that make use to embedded in a Arduino micro controller.

Main Components used:
Arduino Mega as my micro-controller
3 LED's (green, yellow, red)
DC motor (6volt)
2 ultrasonic sensors (HC-SR04)

/*
   This code is designed to control a conveyor system
*/
// Define pins for ultrasonic
int const trigPin = 10; //trigger pin for start sensor
int const echoPin = 9; // echo pin for start sensor
int const trigPin1 = 12; //trigger pin for stop sensor
int const echoPin1 = 11; //echo pin for stop sensor
int motorPin = 4; //conveyor belt motor
int const buttonPin = 2; //ON pushbutton pin
int const buttonPin1 = 3; //Off pushbutton pin
int const GreenledPin = 5; //system ON LED pin
int const YellowledPin = 6; //motor ON LED pin
int const RedledPin = 7; // system OFF LED pin
boolean Redbuttonstate = LOW;
boolean Blackbuttonstate = LOW;
boolean controlstate = LOW;
// variables will change:
//int ONbuttonState = 1; // variable for reading the pushbutton status
//int OFFbuttonState = 1; // variable for reading the pushbutton status
void setup() {
   pinMode(trigPin, OUTPUT); // trig pin will have pulses output for start sensor
   pinMode(echoPin, INPUT); // echo pin should be input to get pulse width for the start sensor
   pinMode(trigPin1, OUTPUT); // trig pin will have pulses output for the stop sensor
   pinMode(echoPin1, INPUT); // echo pin should be input to get pulse width for the stop sensor
pinMode(motorPin, OUTPUT); // motor pin
pinMode(GreenledPin, OUTPUT); // system ON LED
pinMode(YellowledPin, OUTPUT); // motor ON LED
pinMode(RedledPin, OUTPUT); // system OFF LED
pinMode(buttonPin, INPUT); // ON push button(momentary)
pinMode(buttonPin1, INPUT); // OFF push button(momentary)
}

void loop() {
Redbuttonstate = digitalRead(buttonPin);
Blackbuttonstate = digitalRead(buttonPin1);
//if button is pressed system should be on and allow motor to be turned on and off by the start and stop sensors
if (Redbuttonstate == HIGH) {
digitalWrite(controlstate, HIGH); //red button is the ON button so controlstate is HIGH to allow the conveyor system to operate
}
if (Blackbuttonstate == HIGH) {
digitalWrite(controlstate, LOW); //black button is the OFF button so controlstate is LOW to enable red LED and not allow conveyor system to operate.
}
while (controlstate = HIGH) {
   // Duration will be the input pulse width and distance will be the distance to the obstacle in centimeters
   int duration, distance; // distance and duration for the START sensor
   // Output pulse with 1ms width on trigPin
   digitalWrite(trigPin, HIGH);
   delay(1);
   digitalWrite(trigPin, LOW);
   // Measure the pulse input in echo pin
   duration = pulseIn(echoPin, HIGH);
   // Distance is half the duration devided by 29.1
   distance = (duration/2) / 29.1; //distance of object from Start sensor
   int duration1, distance1; // distance and duration for the STOP sensor
   // Output pulse with 1ms width on trigPin
   digitalWrite(trigPin1, HIGH);
   delay(1);
   digitalWrite(trigPin1, LOW);
   // Measure the pulse input in echo pin
   duration1 = pulseIn(echoPin1, HIGH);
   // Distance is half the duration devided by 29.1
   distance1 = (duration1/2) / 29.1; // distance of object from STOP sensor
   digitalWrite(GreenledPin, HIGH); //green LED ON because system is active

if (distance <= 10 && distance >= 0) {
digitalWrite(motorPin, HIGH); // if START sensor detects an object within 10cm motor is activated and belt begins to turn
digitalWrite(YellowledPin, HIGH); // Yellow LED is on indicating that the conveyor bely is in motion
}
if (distance1 <= 10 && distance1 >= 0) {
// Motor off
digitalWrite(motorPin, LOW); // if STOP sensor detects an object within 10 cm motor should turn OFF
digitalWrite(YellowledPin, LOW); //Yellow LED off because the system is no longer in motion
}
delay(60);
}

while (controlstate == LOW) {
   digitalWrite(RedledPin, HIGH); // Red LED is off while the system is off
}

}

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Q2 Design a PLC program, for the conveyor belts that bring out the suitcases at an...
Q2 Design a PLC program, for the conveyor belts that bring out the suitcases at an airport. The circuit must operate as follows: • When the START (a Normally Open push button) is pressed, a siren will sound for 30 seconds. • After 30 seconds, the conveyor will operate, and the siren will stop sounding. • If the STOP (a Normally Closed push button) is pushed, the conveyor will stop. • If the STOP is pressed during the period that...
I've posted this question like 3 times now and I can't seem to find someone that...
I've posted this question like 3 times now and I can't seem to find someone that is able to answer it. Please can someone help me code this? Thank you!! Programming Project #4 – Programmer Jones and the Temple of Gloom Part 1 The stack data structure plays a pivotal role in the design of computer games. Any algorithm that requires the user to retrace their steps is a perfect candidate for using a stack. In this simple game you...
Delta airlines case study Global strategy. Describe the current global strategy and provide evidence about how...
Delta airlines case study Global strategy. Describe the current global strategy and provide evidence about how the firms resources incompetencies support the given pressures regarding costs and local responsiveness. Describe entry modes have they usually used, and whether they are appropriate for the given strategy. Any key issues in their global strategy? casestudy: Atlanta, June 17, 2014. Sea of Delta employees and their families swarmed between food trucks, amusement park booths, and entertainment venues that were scattered throughout what would...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT