Table of Contents

Corning Community College

ENGR1050 C for Engineers

PROJECT: Press The Button (PTB0)

OBJECTIVE

We continue our explorations of the electronics kit, this time by encountering our first interactions with input devices, in the form of the button.

PROCESS

Do note, the productive way to go about this project involves taking the following steps:

If you start too late, and do not ask questions, and do not have enough time and don't know what is going on, you are not doing the project correctly.

TASK

After exploring, assembling, and testing the intended circuit (1 button, 1 red LED, 1 green LED, 1 speaker- all independently connected to the pi via separate GPIO pins), adapt the provided C code to provide software control to coordinate button presses with speaker activations, and have the also independently-connected LEDs light up or turn off to mark whether the button is pressed/speaker is activated or not.

Green means button is pressed/speaker is active.

Red means button is not pressed/speaker is inactive.

GRABIT

To assist with consistency across all implementations, data files for use with this project are available on lab46 via the grabit tool. Be sure to obtain it and ensure your implementation properly works with the provided data.

lab46:~/src/SEMESTER/DESIG$ grabit DESIG PROJECT

EDIT

You will want to go here to edit and fill in the various sections of the document:

STRATEGY

The general core idea of the process (one way of going about it, anyway) can be described as follows:

REPEAT:
    SHOULD THE BUTTON BE PRESSED:
        ACTIVATE THE GREEN LED   -> SENSORY ORGANS SENSE PERTINENT ELECTROMAGNETIC RADIATION
        DEACTIVATE THE RED LED   -> SENSORY ORGANS NO LONGER SENSE ELECTROMAGNETIC RADIATION
        ACTIVATE THE SPEAKER     -> SENSORY ORGANS SENSE PERTINENT ELECTROMAGNETIC RADIATION
    OTHERWISE:
        DEACTIVATE THE GREEN LED -> SENSORY ORGANS NO LONGER SENSE ELECTROMAGNETIC RADIATION
        ACTIVATE THE RED LED     -> SENSORY ORGANS SENSE PERTINENT ELECTROMAGNETIC RADIATION
        DEACTIVATE THE SPEAKER   -> SENSORY ORGANS NO LONGER SENSE ELECTROMAGNETIC RADIATION
    
    DELAY AT LEAST FIFTY MILLISECONDS

SUBMISSION

To be successful in this project, the following criteria (or their equivalent) must be met:

Submit Tool Usage

Let's say you have completed work on the project, and are ready to submit, you would do the following (assuming you have a program called uom0.c):

lab46:~/src/SEMESTER/DESIG/PROJECT$ make submit

You should get some sort of confirmation indicating successful submission if all went according to plan. If not, check for typos and or locational mismatches.

RUBRIC

I'll be evaluating the project based on the following criteria:

91:ptb0:final tally of results (91/91)
*:ptb0:used grabit to obtain project by the Sunday prior to duedate [13/13]
*:ptb0:clean compile, no compiler messages [13/13]
*:ptb0:speaker and button each hooked to unique GPIOs [13/13]
*:ptb0:speaker only makes noise on activation [13/13]
*:ptb0:button state is read, on press code activates speaker [13/13]
*:ptb0:button state (ON, OFF) is indicated by two LEDs [13/13]
*:ptb0:code tracked in lab46 semester repo [13/13]

Pertaining to the collaborative authoring of project documentation

Additionally