#cdavalo1
Explore tagged Tumblr posts
cdavalo1-blog · 10 years ago
Video
tumblr
The more a door is used the brighter its leds become.
Code:
int wdPin=13;
int edPin=12;
int wHall=0;
int eHall=0;
int westLight=3;
int eastLight=5;
int westCount=0;
int eastCount=0;
int totalCount=0;
int westValue=0;
int eastValue=0;
String wdState="closed";
String edState="closed";
int maxValue=255;
void setup() 
{
     pinMode(wdPin, INPUT);
  pinMode(edPin, INPUT);
  pinMode(eastLight, INPUT);
  pinMode(westLight, INPUT);
  Serial.begin(9600);
}
void loop() 
{
    processWest();
    processEast();
    processCount();
    processOutput();
    delay(1000);
}
void processWest()
  {
        wHall = digitalRead(wdPin);
  // Serial.println(wHall);
   if (wdState.equals("closed"))   
   {      
       if(wHall == HIGH) 
       {
           westCount+=40;
           wdState="open";
       }
   }
   else 
   {
     if(wHall==LOW)
     {
       wdState="closed";
     }
   }
     } 
  void processEast()
  {
   eHall = digitalRead(edPin);
    Serial.println(eHall);
    if (edState.equals("closed"))   
   { 
         if(eHall == HIGH) 
         {
           eastCount+=40;
           edState="open";           
         } 
    }
    else 
    {
     if(eHall==LOW)
     {
      edState="closed";
     }
   }
          }
  void processCount()
  {
    totalCount=eastCount+westCount;
    float eastPerc=(float)eastCount/(float)totalCount;
    Serial.println(eastPerc);
    float westPerc=(float)westCount/(float)totalCount; 
    Serial.println(westPerc);
    if(eastCount>0)
    {
      eastValue=maxValue*eastPerc;
    }
    if(westCount>0)
    {
      westValue=maxValue*westPerc;
    }
  }
  void processOutput()
  {
    //int westValue = map(westValue, 0, maxValue, 0, 100);  
    //int eastValue = map(eastValue, 0, maxValue, 0, 100);  
    analogWrite(westLight,westValue);
    analogWrite(eastLight,eastValue);
    Serial.print("West Value: ");
    Serial.println(westValue);
    Serial.print("West Count: ");
    Serial.println(westCount);
    Serial.print("East Value: ");
    Serial.println(eastValue);
    Serial.print("East Count: ");
    Serial.println(eastCount);
    Serial.print("Total Count: ");
    Serial.println(totalCount);
  }
2 notes · View notes
arch497-08 · 10 years ago
Video
tumblr
Midterm prototype
0 notes
arch433 · 11 years ago
Photo
Tumblr media Tumblr media Tumblr media Tumblr media
Surfacing
0 notes
cdavalo1-blog · 10 years ago
Photo
Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media
1 note · View note
cdavalo1-blog · 10 years ago
Video
tumblr
As one enters through a door the opposite door glows brighter to attract people and even out usage of both doors (symmetrical usage).
CODE:
int wdPin=13;
int edPin=12;
int wHall=0;
int eHall=0;
int westLight=3;
int eastLight=5;
int westCount=0;
int eastCount=0;
int totalCount=0;
int westValue=0;
int eastValue=0;
String wdState="closed";
String edState="closed";
int maxValue=255;
void setup() 
{
     pinMode(wdPin, INPUT);
  pinMode(edPin, INPUT);
  pinMode(eastLight, INPUT);
  pinMode(westLight, INPUT);
  Serial.begin(9600);
}
void loop() 
{
    processWest();
    processEast();
    processCount();
    processOutput();
    delay(1000);
}
void processWest()
  {
        wHall = digitalRead(wdPin);
  // Serial.println(wHall);
   if (wdState.equals("closed"))   
   {      
       if(wHall == HIGH) 
       {
           eastCount+=40;
           wdState="open";
       }
   }
   else 
   {
     if(wHall==LOW)
     {
       wdState="closed";
     }
   }
     } 
  void processEast()
  {
   eHall = digitalRead(edPin);
    Serial.println(eHall);
    if (edState.equals("closed"))   
   { 
         if(eHall == HIGH) 
         {
           westCount+=40;
           edState="open";           
         } 
    }
    else 
    {
     if(eHall==LOW)
     {
      edState="closed";
     }
   }
          }
  void processCount()
  {
    totalCount=eastCount+westCount;
    float eastPerc=(float)eastCount/(float)totalCount;
    Serial.println(eastPerc);
    float westPerc=(float)westCount/(float)totalCount; 
    Serial.println(westPerc);
    if(eastCount>0)
    {
      eastValue=maxValue*eastPerc;
    }
    if(westCount>0)
    {
      westValue=maxValue*westPerc;
    }
  }
  void processOutput()
  {
    //int westValue = map(westValue, 0, maxValue, 0, 100);  
    //int eastValue = map(eastValue, 0, maxValue, 0, 100);  
    analogWrite(westLight,westValue);
    analogWrite(eastLight,eastValue);
    Serial.print("West Value: ");
    Serial.println(westValue);
    Serial.print("West Count: ");
    Serial.println(westCount);
    Serial.print("East Value: ");
    Serial.println(eastValue);
    Serial.print("East Count: ");
    Serial.println(eastCount);
    Serial.print("Total Count: ");
    Serial.println(totalCount
    );
  }
1 note · View note
cdavalo1-blog · 10 years ago
Video
tumblr
Sound-Piezo
const int sensorPin=0;
const int ledPin= 3;
const int ledPin1= 5;
const int ledPin2= 6;
const int ledPin3= 9;
const int ledPin4= 10;
const int ledPin5= 11;
const int threshold= 100;
void setup()
{
pinMode(ledPin, OUTPUT);
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
pinMode(ledPin3, OUTPUT);
pinMode(ledPin4, OUTPUT);
pinMode(ledPin5, OUTPUT);
Serial.begin(9600);
}
void loop()
{
int val= analogRead(sensorPin);
if (val >= threshold+900)
{
  digitalWrite(ledPin, HIGH);
  digitalWrite(ledPin1, HIGH);
  digitalWrite(ledPin2, HIGH);
  digitalWrite(ledPin3, HIGH);
  digitalWrite(ledPin4, HIGH);
  digitalWrite(ledPin5, HIGH);
  delay(1000);
  digitalWrite(ledPin, LOW);
  digitalWrite(ledPin1, LOW);
  digitalWrite(ledPin2, LOW);
  digitalWrite(ledPin3, LOW);
  digitalWrite(ledPin4, LOW);
  digitalWrite(ledPin5, LOW);
}
else if (val >= threshold+700)
{
  digitalWrite(ledPin, HIGH);
  digitalWrite(ledPin1, HIGH);
  digitalWrite(ledPin2, HIGH);
  digitalWrite(ledPin3, HIGH);
  digitalWrite(ledPin4, HIGH);
  Serial.println("knock");
  delay(2000);
  digitalWrite(ledPin, LOW);
  digitalWrite(ledPin1, LOW);
  digitalWrite(ledPin2, LOW);
  digitalWrite(ledPin3, LOW);
  digitalWrite(ledPin4, LOW);
}
else if (val >= threshold+500)
{
  digitalWrite(ledPin, HIGH);
  digitalWrite(ledPin1, HIGH);
  digitalWrite(ledPin2, HIGH);
  digitalWrite(ledPin3, HIGH);
  Serial.println("knock");
  delay(1000);
  digitalWrite(ledPin, LOW);
  digitalWrite(ledPin1, LOW);
  digitalWrite(ledPin2, LOW);
  digitalWrite(ledPin3, LOW);
}
else if (val >= threshold+300)
{
  digitalWrite(ledPin, HIGH);
  digitalWrite(ledPin1, HIGH);
  digitalWrite(ledPin2, HIGH);
  delay(1000);
  digitalWrite(ledPin, LOW);
  digitalWrite(ledPin1, LOW);
  digitalWrite(ledPin2, LOW);
}
else if (val >= threshold+100)
{
  digitalWrite(ledPin, HIGH);
  digitalWrite(ledPin1, HIGH);
  delay(1000);
  digitalWrite(ledPin, LOW);
  digitalWrite(ledPin1, LOW);
}
else if (val >= threshold)
{
  digitalWrite(ledPin, HIGH);
  delay(1000);
  digitalWrite(ledPin, LOW);
}
else 
{
  digitalWrite(ledPin, LOW);
  digitalWrite(ledPin1, LOW);
  digitalWrite(ledPin2, LOW);
  digitalWrite(ledPin3, LOW);
  digitalWrite(ledPin4, LOW);
  digitalWrite(ledPin5, LOW);
}
}
0 notes
cdavalo1-blog · 10 years ago
Video
tumblr
#include <Servo.h> 
  Servo myservo;
int potPin = A1;
int val;   
void setup() 
  myservo.attach(6);
  void loop() 
   val = analogRead(potPin);            // reads the value of the potentiometer (value between 0 and 1023) 
    val = map(val, 0, 1023, 0, 180);     // scale it to use it with the servo (value between 0 and 180)
    myservo.write(val);
    }
0 notes
cdavalo1-blog · 10 years ago
Video
tumblr
ASSIGNMENT#4
  const int analogInPin = A1;
const int analogOutPin0 = 3;
const int analogOutPin1 = 5;
const int analogOutPin2 = 6;
const int analogOutPin3 = 9;
const int analogOutPin4 = 10;
const int analogOutPin5 = 11;
  int sensorValue = 0;
int lightValue = 0;
  void setup()
{
  Serial.begin(9600);
}
  void loop()
{
  sensorValue = analogRead(analogInPin);           
  lightValue=map(sensorValue,0,1023,0,600);
  while(lightValue>0)
  {
      analogWrite(analogOutPin0,3);
      lightValue=map(sensorValue,0,1023,0,600);
        while(lightValue>100)
    {
      analogWrite(analogOutPin1,3);
      lightValue=map(sensorValue,0,1023,0,600);
            while(lightValue>200)
      {
        analogWrite(analogOutPin2,3);
        lightValue=map(sensorValue,0,1023,0,600);
               while(lightValue>300)
        {
          analogWrite(analogOutPin3,3);
          lightValue=map(sensorValue,0,1023,0,600);
                    while(lightValue>400)
          {
            analogWrite(analogOutPin4,3);
            lightValue=map(sensorValue,0,1023,0,600);
                        while(lightValue>500)
            {
              analogWrite(analogOutPin5,3);
              lightValue=map(sensorValue,0,1023,0,600);
              break;
            }
            break;
          }
          break;
        }
        break;
      }
      break;
    }
    break;
  }
      lightValue=map(sensorValue,0,1023,0,600);
  while(lightValue==0)
  {
  analogWrite(analogOutPin5,LOW);
  delay(50);
  analogWrite(analogOutPin4,LOW);
  delay(50);
  analogWrite(analogOutPin3,LOW);
  delay(50);
  analogWrite(analogOutPin2,LOW);
  delay(50);
  analogWrite(analogOutPin1,LOW);
  delay(50);
  analogWrite(analogOutPin0,LOW);
  delay(50);
  break;
  }
  Serial.print("sensor = " );                      
  Serial.print(sensorValue);     
  Serial.print("\t output = ");     
  Serial.println(lightValue);  
    delay(2);                    
}
0 notes
cdavalo1-blog · 10 years ago
Video
tumblr
ASSIGNMENT#3
const int led[16]={A5,A4,2,3,4,5,6,7,A1,A2,A3,13,12,11,10,9};
int potPin=A0;
int potValue=0;
int potValue1=0;
int i=0;
void setup()
{
for (int i=0;i<16;i++)
{
pinMode(led[i], OUTPUT);
}
}
void loop()
{
while(i<16)
{
potValue = analogRead(A0);
potValue1=map(potValue, 0, 1023, 0, 500);
digitalWrite(led[i], HIGH);
delay(potValue1);
digitalWrite(led[i], LOW);
delay(potValue1);
i++;
}
i=0;
}
0 notes
cdavalo1-blog · 10 years ago
Photo
Tumblr media Tumblr media
Assignment #3 Pictures
0 notes
cdavalo1-blog · 10 years ago
Video
tumblr
ASSIGNMENT 2
int led[9]={A5,A4,2,3,4,5,6,7,8,};
int led2[9]={9,10,11,12,13,A0,A1,A2,A3};
void setup() {               
  for (int i=0;i<9;i++) {
    pinMode(led[i], OUTPUT);
  }            
  for (int i=0;i<9;i++) {
    pinMode(led2[i], OUTPUT);
  }
}
void loop() {
  for(int i=0;i<9;i++) {     
    for(int j=0;j<9;j++) {
      digitalWrite(led[j], HIGH);
      delay(100);
    }    
    for(int k=8;k>=0;k--) {
      digitalWrite(led[k], LOW);
      delay(0);
    }
    digitalWrite(led2[i], HIGH);
    delay(100);
   }
       for(int i=0;i<9;i++){
      digitalWrite(led[i], HIGH);
      delay(100);
    }
     //Reversed Loop***********************************
     for(int i=8;i>=0;i--) {     
    for(int j=8;j>=0;j--) {
      digitalWrite(led[j], LOW);
      delay(100);
    }    
    for(int k=0;k<9;k++) {
      digitalWrite(led[k], HIGH);
      delay(0);
    }
    digitalWrite(led2[i], LOW);
    delay(100);
  }
    for(int j=8;j>=-1;j--) {
      digitalWrite(led2[j], LOW);
      delay(0);
    }
for(int j=8;j>=-1;j--) {
     digitalWrite(led[j], LOW);
     delay(0);
  }
}
0 notes
cdavalo1-blog · 10 years ago
Video
tumblr
ASSIGNMENT 1
CODE:
int led[6]={8,9,10,11,12,13};
int i=0;
void setup() {               
  pinMode(led[0], OUTPUT);
  pinMode(led[1], OUTPUT);
  pinMode(led[2], OUTPUT);
  pinMode(led[3], OUTPUT);
  pinMode(led[4], OUTPUT);
  pinMode(led[5], OUTPUT);
}
void loop() 
{
  for (i=100;i>0;i-=10)
  {
    for(int n=0;n<=5;n++)
    {
        digitalWrite(led[n], HIGH);
        delay(i);
digitalWrite(led[n], LOW);
delay(i);
    }
    for(int n=5;n>=0;n--)
    {
      digitalWrite(led[n], HIGH);
      delay(i);
      digitalWrite(led[n], LOW);
      delay(i);
    }
  }
    for(i=10;i<=100;i+=10)
  {
    for(int n=0;n<=5;n++)
    {
        digitalWrite(led[n], HIGH);
        delay(i);
    }
    for(int n=0;n<=5;n++)
    {
        digitalWrite(led[n], LOW);
        delay(i);
    }
    for(int n=5;n>=0;n--)
    {
        digitalWrite(led[n], HIGH);
        delay(i);
     }
    for(int n=5;n>=0;n--)
    {
        digitalWrite(led[n], LOW);
        delay(i);
    }
  }
}
0 notes
arch433 · 11 years ago
Photo
Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media
Pocketing
(Big Fan of Playstation)
0 notes
arch433 · 11 years ago
Photo
Tumblr media Tumblr media
Engraving
0 notes
arch433 · 11 years ago
Photo
Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media
Final Fabrication Project
0 notes
arch433 · 11 years ago
Photo
Tumblr media Tumblr media Tumblr media Tumblr media
0 notes