Ishlatgan kodlarim


Download 0.76 Mb.
Sana19.06.2023
Hajmi0.76 Mb.
#1600014
Bog'liq
Dilshodbek


10. 74HC595 mikrosxemasidan foydalangan holda 4 xonali yetti segmentli displey uchun ulanish sxemasi yig’ing va shu sxemada 1111 raqamini namoyish qiling.



ISHLATGAN KODLARIM
#include "Adafruit_LEDBackpack.h"
Adafruit_7segment dis = Adafruit_7segment();

int latchPin = 12;


int clockPin = 11;
int dataPin = 13;

byte numbers[11] = {


0b00000011,
0b10011111,
0b00100101,
0b00001101,
0b10011001,
0b01001001,
0b01000001,
0b00011111,
0b00000001,
0b00001001,
0b11111110

};

byte current = 0;


byte current1 = 0;
void setup()
{
dis.begin(0x70);
pinMode(latchPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);

}

void loop()


{
for (int s =0; s<=9; s++)
{
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, LSBFIRST, numbers[current%11]);
digitalWrite(latchPin, HIGH);
current++;
delay(5000);
for (int s1 =0; s1<=9; s1++)
{
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, LSBFIRST, numbers[current1%11]);
digitalWrite(latchPin, HIGH);
current1++;
delay(500);
}}}
8. 74HC595 mikrosxemasidan foydalangan holda 1 xonali yetti segmentli displey uchun ulanish sxemasi yig’ing va shu sxemada 5 raqamini namoyish qiling.




const char lth = 12;
const char clk = 13;
const char dat = 11;

int bit[9] = {


B01100000,
B11011100,
B11110100,
B01100110,
B10110110,
B10111110,
B11100000,
B11111110,
B11110110
};

void setup()


{
pinMode(lth, OUTPUT);
pinMode(clk, OUTPUT);
pinMode(dat, OUTPUT);
}

void loop()


{
for(int i=0; i<9; i++) {
digitalWrite(lth, 0);
shiftOut(dat, clk, LSBFIRST, bit[i]);
digitalWrite(lth, 1);
delay(750);
}
}
Download 0.76 Mb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling