Friday, December 17, 2010
Thursday, December 16, 2010
Project Code
#include <Servo.h>
#define CLOSED 11
#define ALARM 13
int but = 0;
const int analogPin = 0;
const int ledCount = 8;
int ledPins[] = {
2,3,4,5,6,7,8,9
};
Servo myservo;
int val = 0;
int sensorReading = 0;
#define soundalarm 10
//FUNCTIONS
void setup(){
for (int thisLed = 0; thisLed < ledCount; thisLed++){
pinMode(ledPins[thisLed], OUTPUT);
}
pinMode(CLOSED, INPUT);
pinMode(ALARM, INPUT);
pinMode(soundalarm, OUTPUT);
myservo.attach(12);
myservo.write(val);
}
void senRead(){
int sensorReading = analogRead(analogPin);
if (sensorReading < 550){
senRead();
}
else{
int ledLevel = map(sensorReading, 500, 1023, 0, ledCount);
for (int thisLed = 0; thisLed < ledCount; thisLed++){
if (thisLed < ledLevel){
digitalWrite(ledPins[thisLed], HIGH);
}
else {
digitalWrite(ledPins[thisLed], LOW);
}
}
}
if (sensorReading >= 975){
senRead();
}
delay(1000);
}
void openDoor(){
val = 1500;
myservo.write(val);
delay(1000);
}
void alarm(){
int a = digitalRead(ALARM);
if (a == HIGH){
delay(1000);
alarm2();
}
else{
alarm();
}
}
void alarm2(){
int but = digitalRead(CLOSED);
int a = digitalRead(ALARM);
if (a == HIGH){
digitalWrite(soundalarm, HIGH);
delay(5000);
digitalWrite(soundalarm, LOW);
alarm2();
}
else{
if (but == HIGH){
val = 0;
myservo.write(val);
delay(1000);
clearleds();
}
else{
alarm2();
}
}
}
void clearleds(){
for (int thisLed = 0; thisLed < ledCount; thisLed++){
digitalWrite(ledPins[thisLed], LOW);
}
}
//MAIN LOOP
void loop(){
senRead();
openDoor();
alarm();
}
#define CLOSED 11
#define ALARM 13
int but = 0;
const int analogPin = 0;
const int ledCount = 8;
int ledPins[] = {
2,3,4,5,6,7,8,9
};
Servo myservo;
int val = 0;
int sensorReading = 0;
#define soundalarm 10
//FUNCTIONS
void setup(){
for (int thisLed = 0; thisLed < ledCount; thisLed++){
pinMode(ledPins[thisLed], OUTPUT);
}
pinMode(CLOSED, INPUT);
pinMode(ALARM, INPUT);
pinMode(soundalarm, OUTPUT);
myservo.attach(12);
myservo.write(val);
}
void senRead(){
int sensorReading = analogRead(analogPin);
if (sensorReading < 550){
senRead();
}
else{
int ledLevel = map(sensorReading, 500, 1023, 0, ledCount);
for (int thisLed = 0; thisLed < ledCount; thisLed++){
if (thisLed < ledLevel){
digitalWrite(ledPins[thisLed], HIGH);
}
else {
digitalWrite(ledPins[thisLed], LOW);
}
}
}
if (sensorReading >= 975){
senRead();
}
delay(1000);
}
void openDoor(){
val = 1500;
myservo.write(val);
delay(1000);
}
void alarm(){
int a = digitalRead(ALARM);
if (a == HIGH){
delay(1000);
alarm2();
}
else{
alarm();
}
}
void alarm2(){
int but = digitalRead(CLOSED);
int a = digitalRead(ALARM);
if (a == HIGH){
digitalWrite(soundalarm, HIGH);
delay(5000);
digitalWrite(soundalarm, LOW);
alarm2();
}
else{
if (but == HIGH){
val = 0;
myservo.write(val);
delay(1000);
clearleds();
}
else{
alarm2();
}
}
}
void clearleds(){
for (int thisLed = 0; thisLed < ledCount; thisLed++){
digitalWrite(ledPins[thisLed], LOW);
}
}
//MAIN LOOP
void loop(){
senRead();
openDoor();
alarm();
}
Project 3 - Parts/Product
Inspirational/Helpful Sites
Monday, November 22, 2010
Project 2 - Construction Video
Below is just a quick view around our whole housing for the shot dispenser to give you a look around the entire unit before being a finished piece.
Project 2 - Electronics
This is a short video of the basic servo operation where all we are doing is switching the servo position from 0 degrees to 180 degrees.
Project 2 - Construction
Monday, October 25, 2010
The MQ3 Sensor
Here is a quick image of the MQ-3 alcohol sensor, as well as its pin layout. This alcohol sensor is compatible with the Arduino environment.
Project 2 - Outside Influences
http://vimeo.com/9975062
Here is a short video demonstration of where the inspiration for our project came from.
Here is a short video demonstration of where the inspiration for our project came from.
Thursday, October 21, 2010
Project 2
Today we ordered parts for our second project including a single shot dispenser, alcohol sensor, programmable LEDs, R/F transmitter, servos, touch screen monitor, and LCD display. Can't wait to get the parts in and see what we can put together!!
Monday, October 18, 2010
Thursday, October 14, 2010
Project 1
Thursday, September 23, 2010
Sunday, September 19, 2010
Subscribe to:
Posts (Atom)