Muhammad al-xorazmiy nomidagi toshkent axborot texnologiyalari universtiteti farg’ona filiali “axborot texnologiyalari” kafedrasi


int rowPins[8] = {9,3,2,12,15,11,7,6}



Download 3,56 Mb.
bet21/31
Sana16.04.2022
Hajmi3,56 Mb.
#556003
1   ...   17   18   19   20   21   22   23   24   ...   31
Bog'liq
T.Aynabekov RVT laboratoriya

int rowPins[8] = {9,3,2,12,15,11,7,6}; // Arduino bilan bog’langan matritsa qatorlari int colPins[8] = {13,8,17,10,5,16,4,14}; // Arduino bilan bog’langan matritsa ustunlari // Arduino MEGA uchun pin
int rowPins[8] = {9,3,2,12,55,11,7,6}; // Arduino bilan bog’langan matritsa qatorlari int colPins[8] = {13,8,57,10,5,56,4,54}; Arduino bilan bog’langan matritsa ustunlari
int image[8][8]={ //matritsada ko’rsatilgan rasm : 1 = LED yon, 0 = LED o’ch
{0,1,0,0,0,0,1,0},
{1,1,1,0,0,1,1,1},
{0,1,0,0,0,0,1,0},
{0,0,0,1,1,0,0,0},
{0,0,0,1,1,0,0,0},
{1,0,0,0,0,0,0,1},
{0,1,1,1,1,1,1,0},
{0,0,1,1,1,1,0,0}
};
void setup(){
for (int i=0; i<8; i++){ // hamma pinlar CHIQISH(OUTPUT) deb e’lon qilingan pinMode(rowPins[i],OUTPUT);
pinMode(colPins[i],OUTPUT);
}
}
void loop(){
for (int y=0; y<8; y++){ // chiziq bo’yicha yo’nalish (Построчно)
for (int x=0; x<8; x++){ // kirish barcha to’plamlarni chapdan o’ngga tekshirish if (image[x][y]==1){ // Birinchi kirish
digitalWrite(colPins[x],HIGH); // ustun pinini yoqish
} else { // aks holda
digitalWrite(colPins[x],LOW); // Uni o’chirish
}
}
digitalWrite(rowPins[y],LOW); // Qator pinini LOWga o’zgartirish (chunki u LEDning katodidir, LOW o’chishni bildiradi)
delayMicroseconds(100); // programmani millisekondga to’xtatish
digitalWrite(rowPins[y],HIGH); // Qator pinini HIGHga o’zgartirish (bu yonishni bildiradi)
}
}
4) Programma kodini arduinoga yuklash uchun quyidagi rasmdagi


instrumentga sichqoncha ko’rsatkichini olib borib bosing.
Tizim kompilyatori dasturni tekshirib xatosiz bo’lsa kontrollerga yuklaydi va programma ishga
tushadi. Agar dastur kodida xatolik bo’lsa kompilyator bu xatolikni qizil rang bilan yoritib ko’rsatadi. Xatolikni tuzatib dasturni qayta yuklang.
Amaliy qism

#define ROW1 13
#define ROW2 12
#define ROW3 11
#define ROW4 10
#define ROW5 9
#define ROW6 8
#define ROW7 7
#define ROW8 6

#define COL1 5


#define COL2 4
#define COL3 3
#define COL4 2
#define COL5 A4
#define COL6 A3
#define COL7 A2
#define COL8 A1

const int row[] = {ROW1, ROW2, ROW3, ROW4, ROW5, ROW6, ROW7, ROW8};


const int col[] = {COL1,COL2, COL3, COL4, COL5, COL6, COL7, COL8};

int A[8][8] = {{1,1,1,1,1,1,1,1},


{1,1,1,0,0,1,1,1},
{1,1,0,1,1,0,1,1},
{1,1,0,1,1,0,1,1},
{1,1,0,0,0,0,1,1},
{1,1,0,1,1,0,1,1},
{1,1,0,1,1,0,1,1},
{1,1,1,1,1,1,1,1}};

void setup() {


Serial.begin(9600);
for (int i = 2; i <= 13; i++) {
pinMode(i, OUTPUT);
digitalWrite(i, LOW);
}
pinMode(A1, OUTPUT);
digitalWrite(A1, LOW);
pinMode(A2, OUTPUT);
digitalWrite(A2, LOW);
pinMode(A3, OUTPUT);
digitalWrite(A3, LOW);
pinMode(A4, OUTPUT);
digitalWrite(A4, LOW);
}

void loop() {


delay(10);


yaz(A);

}


void yaz(int matrix[8][8]){
for (int c=0; c<8; c++){

digitalWrite(col[c], HIGH);


for (int r = 0; r < 8; r++){
digitalWrite(row[r], 255*matrix[r][c]);
delay(1);
}
for (int r = 0; r < 8; r++){
digitalWrite(row[r], HIGH);
delay(1);
}
digitalWrite(col[c], LOW);
}
}


Download 3,56 Mb.

Do'stlaringiz bilan baham:
1   ...   17   18   19   20   21   22   23   24   ...   31




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

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish