Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
teaching
nswi170
web
Commits
211b40fe
Commit
211b40fe
authored
Apr 21, 2021
by
Šmelko Adam Mgr.
Browse files
Add recording, update poznamky.
parent
2bfae23c
Changes
2
Hide whitespace changes
Inline
Side-by-side
download/smelko/cvicenie4.txt
View file @
211b40fe
#include "funshield.h"
constexpr int digit_positions =
4
;
constexpr int digit_positions =
sizeof(digit_muxpos) / sizeof(digit_muxpos[0])
;
void writeGlyphBitmask( byte glyph, byte pos_bitmask) {
digitalWrite( latch_pin, LOW);
...
...
@@ -77,3 +77,67 @@ void loop() {
writeDigit(citac, pozicia);
}
###################################SERIAL READ###################################
#include "funshield.h"
constexpr int digit_positions = sizeof(digit_muxpos) / sizeof(digit_muxpos[0]);
void writeGlyphBitmask( byte glyph, byte pos_bitmask) {
digitalWrite( latch_pin, LOW);
shiftOut( data_pin, clock_pin, MSBFIRST, glyph);
shiftOut( data_pin, clock_pin, MSBFIRST, pos_bitmask);
digitalWrite( latch_pin, HIGH);
}
void writeGlyphR(byte glyph, int pos)
{
writeGlyphBitmask(glyph, digit_muxpos[digit_positions - pos - 1]);
}
void writeGlyphL(byte glyph, int pos)
{
writeGlyphBitmask(glyph, digit_muxpos[pos]);
}
void writeDigit(int n, int pos)
{
writeGlyphR(digits[n], pos);
}
void setup() {
Serial.begin(9600);
pinMode(latch_pin, OUTPUT);
pinMode(data_pin, OUTPUT);
pinMode(clock_pin, OUTPUT);
}
void loop() {
if (Serial.available() > 0)
{
int incomingByte = Serial.read();
int cislo = incomingByte - '0';
Serial.println(cislo);
writeDigit(cislo, digit_muxpos[1]);
}
}
###################################DEBUG PRINT###################################
// pouzitie:
// d_print("Teraz vypisem premennu FFF ", FFF, " a aby som odriadkoval, napisem newline \n.");
#define DEBUG 1 // nastav na 0, aby si zakazal debug print
template <typename Arg>
void d_print(Arg arg)
{
#if DEBUG
Serial.print(arg);
#endif
}
template <typename Arg, typename... Rest>
void d_print(Arg arg, Rest... rest)
{
#if DEBUG
d_print(arg);
d_print(rest...);
#endif
}
\ No newline at end of file
index.html
View file @
211b40fe
...
...
@@ -666,7 +666,7 @@ $(document).ready(function(){
<td
class=
"right"
>
21.4.2021
</td>
<td>
934 5196 8778
</td>
<td><a
class=
"extern"
href=
"https://cesnet.zoom.us/j/93451968778"
>
Join the lab - Šmelko
</a></td>
<td>
Recorded lab
</td>
<td>
<a
class=
"extern"
href=
"https://web.microsoftstream.com/video/4f20668a-12ff-4159-b184-4bc1f85bba9a"
>
Recorded lecture
</a>
</td>
</tr>
<tr>
<td
class=
"right"
>
27.4.2021
</td>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment