231a-ag progressnov21

From CSclasswiki
Jump to: navigation, search

Progress Report (as of November 21)

Revised Arduino Schematic

231a-ag revisedArduinoschematic4.png

What I've Done

Keypad

Discoveries

  • I had to add resistors to the input! Otherwise, the keypad would never read properly. So, I added three 10 Kohms resistors to the input for the keypad (also connected to Arduino analog pins 0, 1, 2 and 5V). See below for instructions on how to fix this.

Wiring

  1. Keypad pins 1, 3 and 5 were previously directly connected to the Arduino analog pins. "Unplug" them from the Arduino analog pins, and "plug" them into the breadboard.
  2. Wire a 10 Kohms resistor to each keypad pin.
  3. "Unplug" the buzzer from the 5V pin on the Arduino and "plug" it into the breadboard.
  4. Connect a wire from the 5V pin on the Arduino to the breadboard.
  5. Use wires to connect the three 10 Kohms keypad resistors and the buzzer to 5V on the breadboard.

Other

  • The digital I/O pin 2 on my Arduino is dead, and therefore, I used digital I/O pin 5 instead.

Hardware Testing Code

/*
 * Hardware Testing
 *
 * Program that tests the Arduino hardware.
 *
 */

int ledPin = 8;                   // LED connected to digital pin 8 and 12
int ledPin2 = 12;
int buzzerPin = 13;

int keypadDPin3 = 3;
int keypadDPin4 = 4;
int keypadDPin5 = 5;

int keypadAPin0 = 0;
int keypadAPin1 = 1;
int keypadAPin2 = 2;

int padNumber3 = 0;
int padNumber1 = 0;
int padNumber5 = 0;

int padNumber2 = 0;
int padNumber7 = 0;
int padNumber6 = 0;

void setup()                       // run once, when the sketch starts
{
  pinMode(ledPin, OUTPUT);         // sets the digital pin as output
  pinMode(ledPin2, OUTPUT);
  pinMode(buzzerPin, OUTPUT);
  
  pinMode(keypadDPin3, OUTPUT);
  pinMode(keypadDPin4, OUTPUT);
  pinMode(keypadDPin5, OUTPUT);
  
  pinMode(keypadAPin0, INPUT);
  pinMode(keypadAPin1, INPUT);
  pinMode(keypadAPin2, INPUT);
  
  Serial.begin(9600);
}

void loop()                        // run over and over again
{
  digitalWrite(buzzerPin, LOW);    // sets buzzer on
  digitalWrite(ledPin, LOW);         // test the LED matrix
  digitalWrite(ledPin2, HIGH);

  digitalWrite(keypadDPin3, LOW);
  digitalWrite(keypadDPin4, LOW);
  digitalWrite(keypadDPin5, LOW);

  padNumber3 = analogRead(keypadAPin0);
  padNumber1 = analogRead(keypadAPin1);
  padNumber5 = analogRead(keypadAPin2);

  Serial.println(padNumber3);        // testing the keypad buttons
  Serial.println(padNumber1);
  Serial.println(padNumber5);
}

Pictures

231a-ag newresistors.jpg

  • Where the new resistors were added and connected to 5V (NOT ground! I made a mistake in the photo =( ).

231a-ag finalsetup.jpg

  • The final setup! More or less... it shouldn't have to undergo any more changes?