« Week 2 - Modularity | Main | Week 2 - Observation Assignment »

Week 2 -Combination Locker

box1.jpg

The idea for this assignment was to make something simple. This doesn’t mean that simple is easy. What I learn with this project is that the idea u have in your head and the end result are entire different. (no time, no experience at all, getting crazy). _Lesson number 1: practice a lot!!

Idea:
Create 3 light cubes that must be in the right position to light up
box2.jpg
box3.jpg

Aim:
Learn how to use and create your own switches.

Result:
The direction was to explore more the physical interface rather that the code itself.
Each box was a different position of the switch that only connect with the right switch place on the board. The code is only analyzing if the 3 switches are on and if yes, the led´s inside the box will light up. ( see code below)

Problems:
box4.jpg
Creating the contacts. This was the hard part of the project, for sure. The plastic boxes were very fragile and the box did have enough weight to " force" the contacts to work. Also the " base" where the user put the cubes should be #. Should be with squares holes where the user put the boxes.
When I took the pictures the system was not working so well, The box in the middle wasn’t making the contact and also the others needed a finger help to work.

A combination locker is a kind of game, always. The combination locker we have at school is a game that I would prefer not play everyday --- is a bad interface.
I know that I have to follow 3 steps to open it but I do i know that the first number or second number was ok? Each input should have a feedback, something that tells me that --yes--input number 1, correct!!
I didn’t had time to finish this part but the idea was to give some visual feedback to the user if he put one box in the right position. First, he had a clue that he was doing the right thing (putting the boxes on the board) and second, if he puts one box in the right position, he had know that at least that one was ok. The idea was to create a blink effect feedback.

Applications:
Now that I look for the result of the project, one project that could use this kind of interface is a game of words for kids. Each cube has a letter and when the cubes together for a word the lights of the boxes light up.
( maybe there is something similar on the market, for sure!!)


Schematic: ( have to scan the drawing)

Code:

// declare variables:
int switchPin1 = 2; // digital input pin for switch1
int switchPin2 = 3; // digital input pin for switch2
int switchPin3 = 4; // digital input pin for switch3
int oneLedPin = 6; // digital output pin for 1 LED
int twoLedPin = 7; // digital output pin for 2 LED
int threeLedPin = 8; // digital output pin for 3 LED
int switchState1 = 0; // the state of the switch1
int switchState2 = 0; // the state of the switch2
int switchState3 = 0; // the state of the switch3

void setup() {
// defining input and outputs
pinMode(switchPin1, INPUT); // set the switch1 pin to be an input
pinMode(switchPin2, INPUT); // set the switch2 pin to be an input
pinMode(switchPin3, INPUT); // set the switch3 pin to be an input
pinMode(oneLedPin, OUTPUT); // set the 1 LED pin to be an output
pinMode(twoLedPin, OUTPUT); // set the 2 LED pin to be an output
pinMode(threeLedPin, OUTPUT); // set the 3 LED pin to be an output
}

void loop() {
// read_get something
// read the switch input:
switchState1 = digitalRead(switchPin1);
// is always reading the state of the switch but analizing the pin 2
switchState2 = digitalRead(switchPin2);
// is always reading the state of the switch but analizing the pin 3
switchState3 = digitalRead(switchPin3);
// is always reading the state of the switch but analizing the pin 4
// condition for all switchs
if ((switchState3 == 1) && (switchState2 == 1) && (switchState3 == 1)) {
// write_ do something
// if the 3 switch is closed:
digitalWrite(oneLedPin, HIGH); // turn on the 1 LED
digitalWrite(twoLedPin, HIGH); // turn on the 2 LED
digitalWrite(threeLedPin, HIGH); // turn on the 3 LED
}
else {
// if the switch is open:_ state 0
digitalWrite(oneLedPin, LOW); // turn off the 1 LED
digitalWrite(twoLedPin, LOW); // turn off the 2 LED
digitalWrite(threeLedPin, LOW); // turn off the 3 LED
}
}

TrackBack

TrackBack URL for this entry:
http://www.prntscreen.net/cgi-bin/mt/mt-tb.cgi/20

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About

This page contains a single entry from the blog posted on September 24, 2007 5:32 PM.

The previous post in this blog was Week 2 - Modularity.

The next post in this blog is Week 2 - Observation Assignment.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.35