Показаны различия между двумя версиями страницы.
| Предыдущая версия справа и слеваПредыдущая версияСледующая версия | Предыдущая версия | ||
| products:aruno:exp19 [2020/06/22 17:47] – alexnik | products:aruno:exp19 [2020/06/26 13:19] (текущий) – alexnik | ||
|---|---|---|---|
| Строка 15: | Строка 15: | ||
| <file cpp Exp19[enable_line_numbers=" | <file cpp Exp19[enable_line_numbers=" | ||
| - | int a = 8; | + | const int latchPin |
| - | int b = 9; | + | const int clockPin |
| - | int c = 11; | + | const int dataPin |
| - | int d = 5; | + | int keyPin = 13; |
| - | int e = 4; | + | int data[16] = {254, 176, 237, 249, 179, 219, 223, 240, 255, 243, 247, 159, 206, 189, 199}; |
| - | int f = 7; | + | void Displ(int num); |
| - | int g = 6; | + | |
| - | int h = 10; | + | |
| - | int keyPin = 3; | + | |
| - | int data [11][8] = {{1,1,1,1,1,1,0,1}, //" | + | |
| - | {0,1,1,0,0,0,0,1}, //" | + | |
| - | | + | |
| - | {1, | + | |
| - | {0, | + | |
| - | {1, | + | |
| - | {1, | + | |
| - | {1, | + | |
| - | {1, | + | |
| - | {1, | + | |
| - | {0, | + | |
| - | void displ (int); | + | void setup () { |
| - | + | | |
| - | void setup() { | + | pinMode(clockPin,OUTPUT); |
| - | for(int i=4;i< | + | pinMode(dataPin,OUTPUT); |
| - | pinMode(i,OUTPUT); | + | Displ(0); |
| - | pinMode(keyPin,INPUT); | + | } |
| - | displ(11); | + | |
| - | | + | |
| int x = -1; | int x = -1; | ||
| int button_old = 1; | int button_old = 1; | ||
| - | void loop() { | + | void loop() { |
| | | ||
| x = x + 1; | x = x + 1; | ||
| } | } | ||
| - | displ(11); | + | Displ(0); |
| - | displ(x); | + | Displ(x); |
| - | if (x > 9) {x = 0;} | + | if (x > 15) {x = 0;} |
| - | | + | |
| | | ||
| | | ||
| } | } | ||
| - | void displ (int num) { | + | void Displ(int num) { |
| - | int j = 0; | + | digitalWrite(latchPin,LOW); |
| - | | + | |
| - | | + | digitalWrite(latchPin,HIGH); |
| - | digitalWrite(c, data[num][j]); | + | } |
| - | digitalWrite(d, data[num][j]); j = j + 1; | + | |
| - | digitalWrite(e, data[num][j]); j = j + 1; | + | |
| - | digitalWrite(f, | + | |
| - | digitalWrite(g, | + | |
| - | digitalWrite(dp, | + | |
| - | } | + | |
| </ | </ | ||
| - | В программе | + | В отличие от предыдущей версии " |
| + | В программе мы обрабатываем | ||
| ==== Дополнительное задание ==== | ==== Дополнительное задание ==== | ||
| <WRAP center round tip 60%> | <WRAP center round tip 60%> | ||
| - | * добавьте дополнительно еще | + | Попробуйте добавить еще одну кнопку в проект. |
| - | * усовершенствуйте функцию '' | + | |
| </ | </ | ||