Tuesday, April 12, 2011

4/12/11

  • In the morning we work on the arduino to make combination lock to make the led light up.
  • We used a dip switch for this process and a breadboard , some wire and a arduino.
  • The first step was to put the dip switch in the breadboard and hook it up to power it.
  • the second step was hoking the dip switch to the arduino and a pulldown resistor, then we hook up the wires to the pins on the arduino. i picked 2,3,4,5.
  • Then last we had to create out code so that when we pulled the switches up the led would turn on .
This is the code we made.
/*
Button

Turns on and off a light emitting diode(LED) connected to digital
pin 13, when pressing a pushbutton attached to pin 7.


The circuit:
* LED attached from pin 13 to ground
* pushbutton attached to pin 2 from +5V
* 10K resistor attached to pin 2 from ground

* Note: on most Arduinos there is already an LED on the board
attached to pin 13.


created 2005
by DojoDave <http://www.0j0.org>
modified 17 Jun 2009
by Tom Igoe

This example code is in the public domain.

http://www.arduino.cc/en/Tutorial/Button
*/

// constants won't change. They're used here to
// set pin numbers:
const int buttonPin1 = 2;
const int buttonPin2 = 3;
const int buttonPin3 = 4;
const int buttonPin4 = 5; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin

// variables will change:
int buttonState1 = 0; // variable for reading the pushbutton status
int buttonState2 = 0;
int buttonState3 = 0;
int buttonState4 = 0;
void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin1, INPUT);
pinMode(buttonPin2, INPUT);
pinMode(buttonPin3, INPUT);
pinMode(buttonPin4, INPUT);
}

void loop(){
// read the state of the pushbutton value:
buttonState1 = digitalRead(buttonPin1);
buttonState2 = digitalRead(buttonPin2);
buttonState3 = digitalRead(buttonPin3);
buttonState4 = digitalRead(buttonPin4);

// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if ((buttonState1 == HIGH) && (buttonState2 == HIGH) &&
(buttonState3 == HIGH) && (buttonState4 == HIGH))
{
// turn LED on:
digitalWrite(ledPin, HIGH);
}
else {
// turn LED off:
digitalWrite(ledPin, LOW);
}
}


  • In the afternoon we again worked on out models for the tree guards.
  • I did not have a model so i had to sketch ideas of what i want my tree guard to look like.
  • I then made three models , one with just a cube shape tree guard, the other with just a box shape , and the last one looked like a crown.
  • I had picked the crown shape one that i would put some type of wire on the top that puts the crown shape boards together and circles around the tree.
  • Next class i have to laser cut it out and put it together and put it around a tree model we have made and then our tree models will be done.

No comments:

Post a Comment