Question
You are required to write an object-oriented C++ program which controls the OUSB board from the console. Your console program will display a simple menu
You are required to write an object-oriented C++ program which controls the OUSB board from the console. Your console program will display a simple menu consisting of six options. The six menu options, which are to be displayed to the console, are 1. Press 1 to display the value of PINC on PORTB and to the console 2. Press 2 to display the value of the LDR on PORTB and to the console 3. Press 3 to display the value of the trimpot on PORTB and to the console 4. Press 4 to control the brightness of LED3 with the LDR by using the PWM 5. Press 5 to control the brightness of LED3 with the trimpot by using the PWM 6. Press 6 to exit the program Enter your selection: Menu option 1: Any combination of the switches on PINC will produce a number between 0 and 255. This number is to be read by your console program and then it must send the result to PORTB and display the value on the console, one value per line. Each change in value on PINC, i.e. change in position of one of the DIP switches, must send the resulting value of PINC to PORTB and display the result on the console. Once PINC has been set to 0, this result must be sent to PORTB, your program must clear the console screen and then display the menu. Menu Option 2: The LDR, theoretically, can produce any value between 0 and 1024 since the LDR is connected to a 10-bit analogue to digital converter. After dividing the value by 256, the remainder must be continually sent to PORTB, one value per line, and displayed to the console while PINC is not set to 0. Once PINC is set to 0, your program must stop this operation, clear the console screen and then display the menu. Your program must ensure that only 5 values per second from the LDR are sent to PORTB and displayed to the console. Menu Option 3: The trimpot, theoretically, can produce any value between 0 and 1024 since the trimpot is connected to a 10-bit analogue to digital converter. After dividing the trimpots value by 256, the remainder must be continually sent to PORTB, one value per line, and displayed to the console while PINC is not set to 0. Once PINC is set to -, your program must stop this operation, clear the console screen and then display the menu. Your program must ensure that only 5 values per second from the trimpot are sent to PORTB and displayed to the console. Menu Option 4: The brightness of an LED can be controlled using a pulse-width modulator (PWM). LED3 is connected to channel 1 of the PWM. Your program must control the brightness of LED3 using the LDR value to set the PWM duty cycle, while PINC is not set to 0. Once PINC has been set to 0, your program must stop this operation, clear the console screen and then display the menu. You must scale the output of the LDR such that it has a range between 0 and 100. Menu Option 5: The brightness of an LED can be controlled using a pulse-width modulator (PWM). LED3 is connected to channel 1 of the PWM. Your program must control the brightness of LED3 using the trimpot value to set the PWM duty cycle, while PINC is not set to 0. Once PINC has been set to 0, your program must stop this operation, clear the console screen and then display the menu. You must scale the output of the LDR such that it has a range between 0 and 100. Menu Option 6: The program must exit when this option has been selected.
From the command line, your program can be executed in one of the two following ways: 1. ex1_groupXX.exe id where XX denotes your group number 2. ex1_groupXX.exe where XX denotes your group number If ONE parameter is entered via the command line, the argument must be id, i.e. ex1_groupXX.exe id, otherwise it is an invalid input argument. If the input argument is correct, each student ID string must be displayed to the console in the following form Exercise GROUP XX sXXXXXXX,sXXXXXXX,FirstName,LastName sYYYYYYY,sYYYYYYY,FirstName,LastName sZZZZZZZ,sZZZZZZZ,FirstName,LastName If NO parameters are entered via the command line, i.e. ex1_groupXX.exe, your program must operate as given in the specifications The OUSB board outputs result in default form. E.g. ousb.exe io portb 128 will output PORTB = 128 to the console. You will be required to change this such that the number is ONLY displayed to the console. The only text which can be displayed in the command line is a) text returned from the OUSB board in response to your code. NO debug code must appear in the command line. Access to the OUSB board is via the executable binary file only, i.e. ousb.exe. You will be required to consult the reference manual for the OUSB board, accessible through the Canvas shell, to determine the OUSB commands you will need to use to meet the functional specifications.
Please help me with this problem urgently, thank you
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started