I have attached an image of the setup, here is a schematic view:
/* TRS= 220 Ohm Transistor, LED = Light Emitting Diode, GND = ground
______________
| 13|-TRS---LED---|
| 12|-TRS---LED---|
| 11|-TRS---LED---|
| 10|-TRS---LED---|
| 9|-TRS---LED---|
| 8|-TRS---LED---|
| 6|-TRS---LED---|
| 5|-TRS---LED---|
| 4|-TRS---LED---|
| 3|-TRS---LED---|
| 2|-TRS---LED---|
| 1| |
| GND 0| |
------------- |
| |
----------------------|
*/
I had some trouble with an LED that lit up no matter what I did, so I decided to test the boards digital outputs, now I can't get any of the LED's to light up. As you can see in my code below, I first set alle the pins from 2-13 to OUTPUT. In loop() I check whether a boolean is true or false, set all the pins to HIGH if it is and to LOW if it's not. At the end of loop() I change the state of the boolean before delay()-ing a quarter of a second. As you can see from the image, none of the LED's light up. Here is my code:
boolean on = true;
void setup() {
for (int i = 2; 1 < 13; i++) {
pinMode(i, OUTPUT);
}
void loop() {
if (!on) {
for (int i = 2; i < 13; i++) {
digitalWrite(i, LOW);
}
}
if (on) {
for (int i = 2; i < 13; i++) {
digitalWrite(i, HIGH);
}
}
on != on;
delay(250);
}
EDIT: Changed the code, removed an extra "}" and "pinmode(2,INPUT)", as it was not supposed to be part of the code.
