Spring 2017 CSCI 255 Homework 12

This assignment is due in-class or may be submitted to Homework 12 on moodle by 12:30 PM on 3 May.

This is a check-up on the mastery of circuit stuff.

This exact same problem was done in last term’s CSCI 255. You may pester students from that semester for help!

The prompt

You have been asked to define a breadboard connection for an LED and a switch to an Arduino-like device. The Arduino-like device will provide a Ground connection and the two additional connections for the LED and switch. Assume the switch has been implemented with internal pull-up registers. That way we don’t need a Power connection.

Here is an example of the Arudino program that would use the switch and LED. That might help you to design your circuit. The choice of pin 8 for the switch and pin 12 for the LED is arbitrary.

const int ledPin = 12;
const int switchPin = 8 ;

int switchPressed(int switchPos) {
  return digitalRead(switchPos) == LOW ;
}

// if value is true, turn on led
void ledSet(int switchPos, int value) {
  if (value) {
    digitalWrite(switchPos, HIGH) ;
  } else {
    digitalWrite(switchPos, LOW) ;
  }
}

void setup() {
  pinMode(ledPin, OUTPUT);
  pinMode(switchPin, INPUT_PULLUP) ;
}

void loop() {
  ledSet(ledPin, switchPressed(switchPin)) ;
}

The schematic

Draw a schematic-level diagram for the LED and the switch. Include the appropriate resistors and external connections.

I know you can just download a picture from the internet, but either draw it freehand or use some schematic design tool or build it on a breadboard and take a picture. Be sure to show all components, LED, switch, etc., in your schematic.

The implementation

Using a real breadboard or a breadboard image or or a breadboard-level design program, such as Autodesk Circuits, show how to implement the LED and switch. Leave dangling wires for the three connections.

Use a button switches.

If you use a real breadboard, just take a picture and upload it to the moodle page.

Here’a useful image of a half-size breadboard.
half-size breadboard