For my school project were making a interactive blok puzzel. When the user put the blok in the box, the light in the blok goes on and when it is outside the box it goes off. Now all the electricity connection is all working only the coding needs to be done. This is what we have in our code in the arduino:
int LED1 = 13;
int LED2 = 12;
int LED3 = 11;
void setup() {
// put your setup code here, to run once:
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
pinMode(LED3, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(LED1, HIGH);
digitalWrite(LED2, HIGH);
digitalWrite(LED3, HIGH);
}
Now the only thing that needs to be done is when the user disconnect the led, then a random led between led needs to be shut down permanently. Until all of the leds are off. In this way we are trying te represent Alzheimer. Where the longer the illness is going the more lights in your brain are going out, until there is nothing left.
Your diagram does not show what this: "when the user disconnect the led, " means.
Is there a switch? Does the user tell the Arduino to turn off the LED? Does the user physically unsolder the LED leads? Are the LEDs in sockets with keyways so they will always be connected properly?
Paul
there are three fields where the three LEDs are lit. If the user covers one field with a square cardboard with an LED attached to the bottom, then it will also light up. When the cardboard is removed, its LED should go out and another LED on one of the fields too.
No there is no switch. In the prototype it's a jigsaw puzzle this is how it is supposed to look like a big puzzle from 5 x 5 bloks. How ever this is to much work for us to make, so the teachers said a proof of concept is enough, if we can show the functionality of our application.
The concept of our puzzle to represent the illness Alzheimer. The longer the person is suffering from Alzheimer the more braincells are going to die out, until there is nothing left. With our puzzle we are trying to represent that, by adding a image on top of the blok. When ever the user is putting a blok in the box a light goes on. How ever this puzzle needs to be unsolveble by each time a light randomly goes off. To represent the problem of Alzheimer.
None I have placee no resistors. I am not really experienced with this. It is just that the teachers wanteded a physical application. From students that are following a visuel/ graphic design study
This is NOT how Alzheimers works! A person dies when the disease destroys the part of the brain managing the autonomic functions such as breathing and heat beat.
Paul
You would need some resistors for protecting your LED to not burn out and also to limit the current of the Arduino.
It sounds like you are trying to do two task with a single pin:
First, to power the LED.
Second to detect is a blok is inserted or not. I assume you need to detect if a blok is inserted in order to select a LED to randomly be switched off in the next step.
Using the same pin for both in and output functionality is difficult. It sounds like you might want to try using a dedicated input PIN for each LED to detect if a LED is inserted?
Which is most improbable in the case of Alzheimer's.
Looks elegant, but you have failed to explain so far how you propose to detect the presence of a block, and confusing us with whether or not there are supposed to be LEDs in vacant slots.
You need to realise that a LED requires a current limiting resistor in series. Did you know that? If you do not include this, you risk damage to both the LED and the Arduino. Generally a 220 ohm resistor will be appropriate. I am also assuming you are using white LEDs though that is not critical.
No, it turns out to be dead easy! You can detect the presence of a LED with no other switches. You need to also include a 10k resistor in parallel with the LED in the block. It does not matter whether you choose to put the 220 ohm series resistor in the block or in the connection to the Arduino pin, the latter is perhaps safer.
Now to detect the presence or absence of the LED, your code sets the pinMode of the corresponding Arduino pin to INPUT_PULLUP and reads the pin - if a LED is present it will read LOW, of no LED is present it will read HIGH.
Keep the LED wiring simple. Use 5V LEDs. They have the resistor included in the LED. They usually consume about 10mA so you can connect then directly to the arduino output pins. nqaynt is correct. use separate pins to detect inputs. Its just easier assuming you have enoughpins.
yes. I have not seen the schematic from the topic stater and am wondering how it could be.
I saw a picture with boxes, but I do not understand how it should be a "puzzle" and "unsolvable"