Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

  1. 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
  2. Use the windows command line custom library to collect the real-time keyboard input
  3. 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.
  4. Map the famous WASD keyboard control to control the rotation direction of the array.
  5. Implement a key to stop the rotation.
  6. Implement a key to terminate the program.
  7. 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

  1. _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.
  2. _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.

  1. 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions