As a Senior project I am working on a project for a local company that specializes in helping people who are mentally challenged, or people who have no work skills. The project is kicking my butt because this is my first time working with Arduino, and i am learning everything as I go. This project is a trainer system so the employees can get a feel for what they are doing, and help gain an understanding of the concept of getting all the tools in order.
Here is the Scenario-
I have 10 cubby holes filled with small tools (tiny wrenches, sockets, etc) the people at these stations must take them out put them in a bag or box. Each cubby hole has a different size tool. Each cubby hole has its own Parallax PIR Sensor, and a LEDon the front of each cubby hole. I will also have a buzzer, to tell the employee that you did something wrong.
Here is the sequence-
when you turn on the trainer (after waiting for the sensors to calibrate) the LED on the first cubby hole turns on.
when you stick your hand in the first box to grab a part, the LED on the first box is turned off and the LED on the second box is turned on.
You stick your hand in the second box to grab a part, and the LED on the second box is turned off and the light on the third box is turned on... etc. This cycle repeats until you pull the plug.
Each LED is a guide to tell you which box to pull a part out of.
I have a couple of problems-
- I am not the greatest at programming
- The programing I have done im not sure will work
My Questions and Concerns
-
Will the program that I have attached (minus the buzzer) work like I envisioned?
-
How do I add a buzzer into the program so that when you stick you hand into a box that does not have a light on, the buzzer goes off telling you it is wrong, until you stick your hand into a box with the light on?
-
Do I need a resistor for each LED if the LED's are 3.5v and the output on my Arduino is 3.5?
Here is my program so far:
int LED1pin=11; //LED 1 on output pin 11
int LED2pin=12; //LED 2 on output pin 12
int LED3pin=13; //LED 3 on output pin 13
int LED4pin=14; //LED 4 on output pin 14
int LED5pin=15; //LED 5 on output pin 15
int LED6pin=16; //LED 1 on output pin 16
int LED7pin=17; //LED 2 on output pin 17
int LED8pin=18; //LED 3 on output pin 18
int LED9pin=19; //LED 4 on output pin 19
int LED10pin=20; //LED 5 on output pin 20
int LEDgpin=21; //Green LED on output pin 21
int PIR1pin=1; //PIR 1 on input pin 1
int PIR2pin=2; //PIR 2 on input pin 2
int PIR3pin=3; //PIR 3 on input pin 3
int PIR4pin=4; //PIR 4 on input pin 4
int PIR5pin=5; //PIR 5 on input pin 5
int PIR6pin=6; //PIR 1 on input pin 6
int PIR7pin=7; //PIR 2 on input pin 7
int PIR8pin=8; //PIR 3 on input pin 8
int PIR9pin=9; //PIR 4 on input pin 9
int PIR10pin=10; //PIR 5 on input pin 10
int buzzpin=22; //Buzzer on output pin 1
void setup() //Sets up arduino inputs and outputs
{
pinMode(LED1pin, OUTPUT); //Sets LED 1 as an output
pinMode(LED2pin, OUTPUT); //Sets LED 2 as an output
pinMode(LED3pin, OUTPUT); //Sets LED 3 as an output
pinMode(LED4pin, OUTPUT); //Sets LED 4 as an output
pinMode(LED5pin, OUTPUT); //Sets LED 5 as an output
pinMode(LED6pin, OUTPUT); //Sets LED 6 as an output
pinMode(LED7pin, OUTPUT); //Sets LED 7 as an output
pinMode(LED8pin, OUTPUT); //Sets LED 8 as an output
pinMode(LED9pin, OUTPUT); //Sets LED 9 as an output
pinMode(LED10pin, OUTPUT); //Sets LED 10 as an output
pinMode(LEDgpin, OUTPUT); //Sets green LED as an output
pinMode(buzzpin, OUTPUT); //Sets buzzer as an output
pinMode(PIR1pin, INPUT); //Sets PIR 1 as an input
pinMode(PIR2pin, INPUT); //Sets PIR 2 as an input
pinMode(PIR3pin, INPUT); //Sets PIR 3 as an input
pinMode(PIR4pin, INPUT); //Sets PIR 4 as an input
pinMode(PIR5pin, INPUT); //Sets PIR 5 as an input
pinMode(PIR6pin, INPUT); //Sets PIR 6 as an input
pinMode(PIR7pin, INPUT); //Sets PIR 7 as an input
pinMode(PIR8pin, INPUT); //Sets PIR 8 as an input
pinMode(PIR9pin, INPUT); //Sets PIR 9 as an input
pinMode(PIR10pin, INPUT); //Sets PIR 10 as an input
}
void loop() //runs program continuously
{
digitalWrite(LED1pin, HIGH); //turns on LED 1
digitalWrite(LEDgpin, HIGH); //Turns on Green indicator light to tell the trainer is working
{
do //check if PIR sensor is high, but if its low then
{ //it keeps checking until its high
if(digitalRead(PIR1pin) == HIGH) //Checks if PIR sensor is High
{
digitalWrite(LED1pin, LOW); //turns off LED 1
digitalWrite(LED2pin, HIGH); //turns on LED 2
}
}
while (digitalRead(PIR1pin) == LOW); //if PIR is low, then it repeats this specific sequence
do //check if PIR sensor is high, but if its low then
{ //it keeps checking until its high
if(digitalRead(PIR2pin) == HIGH) //Checks if PIR sensor is High
{
digitalWrite(LED2pin, LOW); //turns off LED 2
digitalWrite(LED3pin, HIGH); //turns on LED 3
}
}
while (digitalRead(PIR2pin) == LOW); //if PIR is low, then it repeats this specific sequence
do //check if PIR sensor is high, but if its low then
{ //it keeps checking until its high
if(digitalRead(PIR3pin) == LOW) //Checks if PIR sensor is High
{
digitalWrite(LED3pin, LOW); //turns off LED 3
digitalWrite(LED4pin, HIGH); //turns on LED 4
}
}
while (digitalRead(PIR3pin) == LOW); //if PIR is low, then it repeats this specific sequence
do //check if PIR sensor is high, but if its low then
{ //it keeps checking until its high
if(digitalRead(PIR4pin) == HIGH) //Checks if PIR sensor is High
{
digitalWrite(LED4pin, LOW); //turns off LED 4
digitalWrite(LED5pin, HIGH); //turns on LED 5
}
}
while (digitalRead(PIR4pin) == LOW); //if PIR is low, then it repeats this specific sequence
do //check if PIR sensor is high, but if its low then
{ //it keeps checking until its high
if(digitalRead(PIR5pin) == HIGH) //Checks if PIR sensor is High
{
digitalWrite(LED5pin, LOW); //turns off LED 5
digitalWrite(LED6pin, HIGH); //turns on LED 6
}
}
while (digitalRead(PIR5pin) == LOW); //if PIR is low, then it repeats this specific sequence
do //check if PIR sensor is high, but if its low then
{ //it keeps checking until its high
if(digitalRead(PIR6pin) == HIGH) //Checks if PIR sensor is High
{
digitalWrite(LED6pin, LOW); //turns off LED 6
digitalWrite(LED7pin, HIGH); //turns on LED 7
}
}
while (digitalRead(PIR6pin) == LOW); //if PIR is low, then it repeats this specific sequence
do //check if PIR sensor is high, but if its low then
{ //it keeps checking until its high
if(digitalRead(PIR7pin) == HIGH) //Checks if PIR sensor is High
{
digitalWrite(LED7pin, LOW); //turns off LED 7
digitalWrite(LED8pin, HIGH); //turns on LED 8
}
}
while (digitalRead(PIR7pin) == LOW); //if PIR is low, then it repeats this specific sequence
do //check if PIR sensor is high, but if its low then
{ //it keeps checking until its high
if(digitalRead(PIR8pin) == HIGH) //Checks if PIR sensor is High
{
digitalWrite(LED8pin, LOW); //turns off LED 8
digitalWrite(LED9pin, HIGH); //turns on LED 9
}
}
while (digitalRead(PIR8pin) == LOW); //if PIR is low, then it repeats this specific sequence
do //check if PIR sensor is high, but if its low then
{ //it keeps checking until its high
if(digitalRead(PIR9pin) == HIGH) //Checks if PIR sensor is High
{
digitalWrite(LED9pin, LOW); //turns off LED 9
digitalWrite(LED10pin, HIGH); //turns on LED 10
}
}
while (digitalRead(PIR9pin) == LOW); //if PIR is low, then it repeats this specific sequence
do //check if PIR sensor is high, but if its low then
{ //it keeps checking until its high
if(digitalRead(PIR10pin) == HIGH) //Checks if PIR sensor is High
{
digitalWrite(LED10pin, LOW); //turns off LED 10
digitalWrite(LED1pin, HIGH); //turns on LED 1
}
}
while (digitalRead(PIR10pin) == LOW); //if PIR is low, then it repeats this specific sequence
}
}
Please help me as soon as possible! This is very important for these people and my graduation!
Thanks!!
-Live Long and Prosper
[timestamp=1292373076]