Quantcast
Channel: MSP430 Technical Forums
Viewing all articles
Browse latest Browse all 2077

Initaliaze outputs to zero upon start up - MSP430G2553

$
0
0

Hi.

 

My outputs go high upon powerup and this is a problem for my application because my power consumption is too high. How do i intalize them in the low state? ...everything else works as expected.

 

/************** code ****************

// Program flashes 8 leds in sequence with a variable rate adjusted by button

 

int timer = 1000;           // The higher the number, the slower the timing.
int ledPins[] = {3, 4, 6, 7, 8, 9, 10, 11};       // an array of pin numbers to which LEDs are attached

int buttonPushCounter = 1;   // counter for the number of button presses
int buttonState = 0;         // current state of the button
// int lastButtonState = 0;     // previous state of the button


const int pinCount = 8;           // the number of pins (i.e. the length of the array)
const int  buttonPin = PUSH2;


void setup()
{
  // put your setup code here, to run once:
 
  // initialize the button pin as a input:
  pinMode(buttonPin, INPUT_PULLUP);
  // initialize the array
    for (int thisPin = 0; thisPin < pinCount; thisPin++)  
    {
    pinMode(ledPins[thisPin], OUTPUT);   

    digitalWrite(ledPins[thisPin], LOW);                          // <-----------GOT IT! NEEDED TO ADD THIS LINE
    }
   pinMode(2, OUTPUT);   
   digitalWrite(2, LOW);   
   pinMode(14, OUTPUT);
   digitalWrite(14, LOW);  
}
 


Viewing all articles
Browse latest Browse all 2077

Trending Articles