Jonathan Wegener
/
Lab2
Revision 1:6517131365fd, committed 2014-09-12
- Comitter:
- jonathanw2
- Date:
- Fri Sep 12 13:14:50 2014 +0000
- Parent:
- 0:74cdf4a589af
- Commit message:
- Report;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
report.txt | Show annotated file Show diff for this revision Revisions of this file |
diff -r 74cdf4a589af -r 6517131365fd main.cpp --- a/main.cpp Mon Sep 08 17:24:37 2014 +0000 +++ b/main.cpp Fri Sep 12 13:14:50 2014 +0000 @@ -12,16 +12,28 @@ DigitalOut sevenSegP9(p19); DigitalOut sevenSegP10(p20); +DigitalIn optoInter(p15); + DigitalOut pinArray[8] = {sevenSegP1, sevenSegP2, sevenSegP4, sevenSegP5, sevenSegP6, sevenSegP7, sevenSegP9, sevenSegP10}; -int one = 20; +int tmp = 23; -int numInBinary[36] = {20}; +int numInBinary[36] = {119, 20, 179, 182, 212, 230, 231, 52, 247, 246, 245, 199, 131, 151, 227, 225, 103, 213, 65, 23, 209, 67, 165, 133, 135, 241, 244, 129, 102, 195, 7,87}; void changeNumber(int num); int main() { - changeNumber(0); + + int i = 0; + changeNumber(i); + while(1){ + if(!optoInter){ + i = (i+1)%32; + changeNumber(i); + while(!optoInter){ + } + } + } } void changeNumber(int num){
diff -r 74cdf4a589af -r 6517131365fd report.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/report.txt Fri Sep 12 13:14:50 2014 +0000 @@ -0,0 +1,11 @@ +Lab2 - Letter Counter +Students: Andre Kuhlenschmidt + and: Jonathan Wegener + +Results: + +During this lab we accomplished all the initial objectives. Our first step was to write up a diagram of how we wanted to wire our bread board. We then proceed to wire and test the seven segment display. Then we wrote a simple driver to display 0-31 in hex using the binary representations of numbers. After we had that working we proceed to wire the optical interrupter and treat that as a digital input in our program. After that we plugged everything together and wrote a letter counter which counts the number of times something passes in between the optical interrupter. + +Difficulties: During this lab our only real difficulty pertained to the optical interrupter. We initially misunderstood the data sheet and tried to wire it with a 10K resistor. After we realized our mistake we quickly rectified it and everything worked as expected. + +What did I learn: During this lab we learned about how to design circuit diagrams, how to wire a seven segment display, and how to wire and use an optical interrupter. We also learned how to properly read and use datasheets for wiring