This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: Code Composer Studio
I have a project , where assign one internal button to turn on both leds , other two external buttons to trun on red led and the other one tho trun on green led I make a code in C , but I dosent work I dont know what I miss to make my code funtional can this community help me ??
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer P1DIR |= 0x41; P1OUT |= BIT3; P1OUT |= BIT4; P1OUT |= BIT5; P1REN |= BIT3; P1REN |= BIT4; P1REN |= BIT5; P1OUT &= ~BIT6; P1OUT &= ~BIT0; while (1) // Infinite Loop { while (P1IN & BIT3){ __delay_cycles(50000); } if ((BIT3 & P1IN)){ P1OUT &= ~BIT6; P1OUT &= ~BIT0; } if ((BIT4 & P1IN)) { P1OUT&= ~BIT0; } if ((BIT5 & P1IN)) { P1OUT &= ~BIT6; } else { P1OUT &= ~BIT6; P1OUT &= ~BIT0;} }}
Hey Bertha,
What GPIO are your LEDs connected to? Are these working correctly?
What IOs are you buttons connected to? Are these IOs working as expected?
I would suggest just blinking the LED's first to make sure you have the GPIO setup and working as you expect. Then I would implement a single button polling and test it with your working LEDs.
We have some example code available, but it may be using different pins than in your application. Blinking example
Thanks,
JD
**Attention** This is a public forum