Gast
#2255116
Hallo! Ich habe einen MSP430f2012 und möchte alle LEDs leuchten lassen, wenn eine Taste gedrückt wird. #include <msp430x20x2.h> // Pins on the MSP430 we're using #define LED1 BIT1 // LED on P1.1 #define LED2 BIT2 // LED on P1.2 #define LED3 BIT3 // LED on P1.3 #define LED4 BIT4 // LED on P1.4 #define BUTTON1 BIT5 // Button on P1.5 #define BUTTON2 BIT6 // Button on P1.6 #define BUTTON3 BIT7 // Button on P1.7 void main( void ) { WDTCTL = WDTPW + WDTHOLD; BCSCTL1 = CALBC1_1MHZ; DCOCTL = CALDCO_1MHZ; BCSCTL2 &= ~(DIVS_3); // Turn on the LED if(BUTTON1 == ??) { P1DIR |= (BIT1|BIT2|BIT3|BIT4); P1OUT |= BIT1; P1OUT &= ~BIT4; } } Meine erste Frage wäre: Wie kann der Programm wissen, dass die Taste am P1.5 gedrückt ist? Sein Handbuch habe ich schon gelesen!