Coder Social home page Coder Social logo

cpe1040-cre-week9-part1's Introduction

CPE 1040 - Comprehensive Review & Enrichment - Week 9 - Python: Part 1

Part I of the CRE in week 9 consists of a programming assignment for the micro:bit in MicroPython.

Requirements

Overview

Write an application which interprets binary strings as unsigned and signed integers, floating point reals, and character strings.

Detailed requirements

Screens

"Screens" is used in the sense of sub-programs, which are mutually exclusive (that is, only one can be active at a time), and each of which has a distinct function. The application should have two pages:

  1. Definition of a 32-bit binary pattern (that is, a sequence of 32 1s and 0s).
  2. Interpretation of the 32-bit pattern as different formats and presentation of the interpretation in decimal.

Bit pattern definition screen

  1. The bit pattern should be represented on the LEDs of the micro:bit, from top-left to bottom-right, row-by-row.
  2. Use two pages, one for the first 25 bits, and a second for the remaining 7 bits.
  3. Use a blinking cursor to indicate which bit is being selected. Start from the top-left-most bit and go across and down, line-by-line.
  4. Button B advances the cursor.
  5. Button A toggles the value of the current bit.
  6. The LEDs mean the following:
    1. LED on: 1
    2. LED off: 0
Example bit pattern
bit_pattern = '10001111010101001001100011110010'

Interpretation screen

  1. The 32-bit pattern from the other screen should be interpreted in 4 different ways:
    1. U - unsigned integer
    2. I - signed integer
    3. F - floating-point real (single-precision IEEE 754 floating point)
    4. C - a string of 4 ASCII characters (Note: Some ASCII values might not have character representations on the micro:bit.)
  2. The screen has two different pages:
    1. Format menu, which cycles through U, I, F, and C images (that is, user-defined Image() constants)
    2. Value page, which scrolls the interpreted number or string, and then returns to the format menu.
  3. Button A cycles through the format menu.
  4. Button B switches to the value menu with the currently selected format.
  5. Hint: There are datatype conversion functions in Python/MicroPython. You don't have to write them from scratch.

Toggling between screens

  1. Use a long press of button B to toggle between bit pattern definition and interpretation screens.

Submission

  1. Fork this repository on Github.
  2. Clone to PyCharm (or an alternative Git interface).
  3. Add a Python file to the repository. Don't forget to git add it, too.
  4. Code in PyCharm and mu, and test until you are satisfied with the functionality.
  5. Commit your code in PyCharm (or an alternative Git interface).
  6. Push to remote on Github.

Guidance

Detailed assignment guidance can be found in the program notes.

cpe1040-cre-week9-part1's People

Contributors

ivogeorg avatar

Stargazers

Brad Hullinger avatar

Watchers

James Cloos avatar  avatar timothyheyer avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.