Question
LED Rolling Display on Console Screen (Recommended IDE DEV-C++) Youve learned how to create a 6 x 24 array of digits and rotate it to
LED Rolling Display on Console Screen (Recommended IDE DEV-C++)
Youve learned how to create a 6 x 24 array of digits and rotate it to mimic a rolling LED display on the console screen. This assignment extends on what youve developed in class, and adds a bit more real-time control flavor to it. After completing this assignment, you will have two key building blocks to start on the course project.
In this assignment, you are expected to:
- Initialize the 6x24 integer array with the following contents: 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010
- Use the
windows command line custom library to collect the real-time keyboard input - Build a 2D array rolling algorithm so that you can continuously rotate the display in UP, DOWN, LEFT, and RIGHT directions. Continuous rotation means the animation should go on forever until another command is issued.
- Map the famous WASD keyboard control to control the rotation direction of the array.
- Implement a key to stop the rotation.
- Implement a key to terminate the program.
- This time, you may have to adjust the sleeping time more carefully (possibly using the usleep() instead) to prevent staggering program reaction to keyboard inputs.
Some Helpful Functions
- _kbhit() A function from conio.h library that checks whether a keyboard key was pressed use this to check whether a new key press was recorded.
- _getch() A function from conio.h library that returns the most recent character recorded upon the key press event. use this to retrieve the character recorded.
- usleep() Put the Program Execution to Sleep, with microsecond granularity use this call from unistd.h library to put your program to sleep for an arbitrary time. usleep(500000); //sleeps for 500000us = 500ms = 0.5s
Example Execution
Refer to the executable program in the assignment.
Deliverables (Total 70 points)
- The program must initialize the 6x24 array with the correct pattern and display a static image on the console screen upon startup (10 pt)
- The six user control commands must be properly implemented.
- w for upward rotation (5 pt)
- s for downward rotation (5 pt)
- a for leftward rotation (5 pt)
- d for rightward rotation (5 pt)
- A selected key to terminate the program (5 pt)
- A selected key to halt the animation (5 pt)
- Animation is generated with a reasonable speed (10 pt)
- The rolling display animation must continue until the next key press takes place (10 pts)
- Proper comments are included (10 pt)
- Code is implemented in a structured way (10 pt)
- Header, directives, constant definition, main function, variable declaration, program contents, proper indentation for clarity.
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