Project 8 lighting sequence revered

so i changes a few numbers and a few signs and i have the light going in reverse to the program in the book but the light are dim and the tilt switch has no effect now.

const int switchPin = 8; unsigned long previousTime = 0; int switchState = 0; int previousSwitchState = 0; int led = 7; long interval = 500; void setup() { for(int x = 7;x>8;x--){ pinMode(x, OUTPUT); } pinMode(switchPin, INPUT); } void loop() { unsigned long currentTime = millis(); if(currentTime - previousTime > interval) { previousTime = currentTime; digitalWrite(led, HIGH); led--; if(led == 2) { } } switchState = digitalRead(switchPin); if(switchState != previousSwitchState){ for(int x = 2; x>8;x--){ digitalWrite(x, LOW); } led = 7; previousTime = currentTime; } (previousSwitchState = switchState); }

do you think this will do anything?   for(int x = 7;x>8;x--){ or that one    for(int x = 2; x>8;x--){

what is this for?

    if(led == 2) {
    }

and what prevents led from becoming negative? do you have a -33 pin number on your arduino?

so i changes a few numbers and a few signs

well in doing random changes you got crappy code... sorry.. you'll have to fix that...


Please correct your post above and add code tags around your code: [code][color=blue]// your code is here[/color][/code].

It should look like this:// your code is here (Also press ctrl-T (PC) or cmd-T (Mac) in the IDE before copying to indent your code properly)

Hi, Welcome to the forum.

Please read the first post in any forum entitled how to use this forum. http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code. It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Also post the original code so we can see where you made the changes.

Thanks.. Tom.. :)