Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is using C Programming and the background information for the lab. 1. Write

ID: 2293639 • Letter: T

Question

This is using C Programming and the background information for the lab.

1. Write a complete C function1 that configure the four buttons S1-S4 on our lab development board. Use the schematic for the development board on the course website for information about how the buttons are connected.

2. Write a complete C function to read the state of the four buttons on the development board, returning an a variable of type char. An example prototype for this function would be as follows:
char readButtons(void); // Example Prototype

The return value from each function should indicate the state of each button in the lower four bits. For example, bit 0 of the return value should give the state of S4 (the rightmost button), bit 1 should give the state of S3, and so on. Again, you can find information on the configuration of the buttons (like their pin numbers) in the development board schematic on the course website.

3. Each note in the song you play is defined by two components: the pitch of the note, and the duration the note should be played. In order to play a song, you will need to find a way to store both properties for each note. You will also need to find a way to map notes to LEDs such that the same note always lights the same LED. With only 4 multi-colored LEDs, the same LED will need to correspond to more than one note (this is the case in Guitar Hero, too).What data structure(s) will you use to store pitch, duration, and the corresponding LED for each note?

MSP430 Hero! Basic requirements: . Play a song on the buzzer and flash the blue LEDs accordingly . Press buttons at the right times to score points . This is a two week lab. You will have this lab session and next week's to work! Feel free to add more features than are in the lab document-we may award extra credit! Show the song on the display (like actual Guitar Hero) - Multiple songs Other ideas?

Explanation / Answer

//Demo app to blink the red LED (LED1) on the TI Launchpad
//which is attached to P1.0
//The green LED(LED2) is connected to P1.6
#include <msp430g2553.h>
int main(void) {
volatile int i;
// stop watchdog timer
WDTCTL = WDTPW | WDTHOLD;
// set up bit 0 of P1 as output
P1DIR = 0x01;
// intialize bit 0 of P1 to 0
P1OUT = 0x00;
// loop forever
for (;;) {
// toggle bit 0 of P1
P1OUT ^= 0x01;
// delay for a while
for (i = 0; i < 0x6000; i++);
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote