This repository has been archived by the owner on Dec 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Koodi korjauksia segmentit, painikkeet ja peli motoriikka
Korjasin painikkeiden, segmenttien toiminnallisuutta vastaamaan vuokaavion suunitelmaa. Nyt segmentisä näkyy highscore oikein, sekä secore. Peli käynistyy mitä tahansa painiketta painamalla. Todo pelinopeus säädettävä.
- Loading branch information
Showing
4 changed files
with
110 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,10 @@ | ||
#ifndef DISPLAY_H | ||
#define DISPLAY_H | ||
|
||
#include <Arduino.h> // Sisältää tarvittavat Arduino-kirjastot | ||
#include <Arduino.h> | ||
|
||
// Funktioiden otsikot: | ||
|
||
/* | ||
initializeDisplay subroutine initializes 5 pins needed for controlling 7-segment | ||
displays in a cascade as follows: | ||
Arduino pin 12 = serial to parallel component reset | ||
Arduino pin 11 = serial to parallel component shiftClock | ||
Arduino pin 10 = serial to parallel component latchClock | ||
Arduino pin 9 = serial to parallel component outEnable | ||
Arduino pin 8 = serial to parallel component serialInput | ||
*/ | ||
void initializeDisplay(void); | ||
void updateDisplay(int score); | ||
void clearDisplay(void); | ||
|
||
/* | ||
WriteByte subroutine writes number 0,1,...,9 to | ||
7-segment display. If there are many 7-segment | ||
displays cascaded, last parameter can be used to | ||
control when number is actually shown at the outputs of | ||
display element. | ||
Parameters: | ||
uint8_t number: accepts values 0,1,..,9 | ||
bool last: either true or false. True = number is displayed | ||
at the output, false is used if this function is called | ||
multiple times to write all cascaded numbers to 7-segment | ||
displays. | ||
*/ | ||
void writeByte(uint8_t number, bool last); | ||
|
||
/* | ||
writeHighAndLowNumber subroutine writes a number 0,1,..,99 | ||
to 2 cascaded 7-segment displays. This subroutine uses | ||
WriteByte subroutine to write 2 numbers to the display. | ||
Parameters: | ||
uint8_t tens: number 0,1,..,9 | ||
uint8_t ones: number 0,1,..,9 | ||
*/ | ||
void writeHighAndLowNumber(uint8_t tens,uint8_t ones); | ||
|
||
/* | ||
showResuts(byte result) This function separates tens and ones | ||
from a result number and calls writeHighAndLowNumber subroutine | ||
to actually write the number to 7-segment display. | ||
Parameters: | ||
byte result: A number between 0,1,..,99. This function | ||
*/ | ||
void showResult(byte result); | ||
|
||
#endif // DISPLAY_H | ||
#endif |