2-Laboratoriya ishi:
Ishdan maqsad: RGB Led lampa yordamida lampani xar hil yoqish, 7 Segmentli display yordamida sonlar hamda harflar chiqarish va ixtiyorish holatda 1 dona ish.
Kerakli komponentlar:
Quyida keltirilgan kerakli komponentlar va elementlar virtual platformada mavjud va ulardan foydalaniladi.
1. Tinkercad.com
2. Arduino UNO kontrolleri - 3ta;
3. Breadboard doskasi - 1ta
4. RGB Led lampa - 1ta;
5. qarshilik 220 Om - 5ta;
6. aloqa simlari;
7. bir razryadli 7 Segmentli display - 1ta;
8. Led lampa – 64ta.
Nazariy qism
Ishni bajarish tartibi:
https://www.tinkercad.com/ birinchi navbatda sayt orqali virtual ekranga kirib olamiz, so’ngra virtual kerakli jihozlar orqali asosiy ekranga:
Virtual Arduino qurulmasi, RGB Led lamp, Breadboard doskasi, Qarshiliklar, 7 Segmentli display va Ulagich simlarini berilgan topshiriq uchun virtual muhitni hosil qilamiz.
1-ishim:
Virtual Arduino qurulmasi, RGB Led lampa, qarshilik va ulagich simlar yordamida RGB Led lampani turli ranglarda yoqdim. Hozirgi kodimda write_color(245, 55, 255); turibdi bu degani RGB lampamiz sariq rang yonadi degani. Ushbu kodni ichidagi raqamlarni o’zgartirish orqali 2563 ta rangni chiqarish mumkin.
RGB lampani yoqishning strukturaviy sxemasi (1.1-rasm)
RGB lampani yoqishning elektron sxemasi (1.2-rasm)
Laboratoriya ishining strukturaviy va elektron sxemasi yordamida Tinkercad.com platformasida ishni emulatsion formasi xosil qilinadi (1.3-rasm).
Kod qismi:
#define Red_led 7
#define Blue_led 5
#define Green_led 3
void write_color(byte r, byte b, byte g){
analogWrite(Red_led, r);
analogWrite(Blue_led, b);
analogWrite(Green_led, g);
}
void setup(){
pinMode(Red_led, OUTPUT);
pinMode(Blue_led, OUTPUT);
pinMode(Green_led, OUTPUT);
write_color(245, 55, 255);
}
void loop(){
}
Tinkercad.com saytidagi link:
https://www.tinkercad.com/things/2p1G6ob7QK8-bodacious-densor-kup/editel?sharecode=bzpLtxM9FLHl5fwUc5iKuICGnESCFZljNfGVXSq54Y8
2-ishim:
Virtual Arduino qurulmasi, 7 Segmentli display, qarshiliklar, breadboard doskasi va ulagich simlar yordamida bir ajoyib ilon izini chiqardim bunda har 1 sekunda 2ta yo’lini yoritib boradi. Buni yaxshilab tushinish uchun link orqali saytda o’zingiz ishlatib ko’rishingiz mumkin.
Bir razryadli 7 Segmentli displayni ishlatishning strukturaviy sxemasi (2.1-rasm)
Bir razryadli 7 Segmentli displayni ishlatishning elektron sxemasi (2.2-rasm)
Laboratoriya ishining strukturaviy va elektron sxemasi yordamida Tinkercad.com platformasida ishni emulatsion formasi xosil qilinadi (2.3-rasm).
Kod qismi:
unsigned const int A = 13; unsigned const int B = 12;
unsigned const int C = 11; unsigned const int D = 10;
unsigned const int E = 9; unsigned const int F = 8;
unsigned const int G = 7; unsigned const int H = 6;
void setup(void){
pinMode(A, OUTPUT); pinMode(B, OUTPUT);
pinMode(C, OUTPUT); pinMode(D, OUTPUT);
pinMode(E, OUTPUT); pinMode(F, OUTPUT);
pinMode(G, OUTPUT); pinMode(H, OUTPUT);}
void CD(void) {
digitalWrite(A, 0); digitalWrite(B, 0);
digitalWrite(C, 1); digitalWrite(D, 1);
digitalWrite(E, 0); digitalWrite(F, 0);
digitalWrite(G, 0); digitalWrite(H, 0);}
void DA(void) {
digitalWrite(A, 1); digitalWrite(B, 0);
digitalWrite(C, 0); digitalWrite(D, 1);
digitalWrite(E, 0); digitalWrite(F, 0);
digitalWrite(G, 0); digitalWrite(H, 0);}
void AE(void) {
digitalWrite(A, 1); digitalWrite(B, 0);
digitalWrite(C, 0); digitalWrite(D, 0);
digitalWrite(E, 1); digitalWrite(F, 0);
digitalWrite(G, 0); digitalWrite(H, 0);}
void EF(void) {
digitalWrite(A, 0); digitalWrite(B, 0);
digitalWrite(C, 0); digitalWrite(D, 0);
digitalWrite(E, 1); digitalWrite(F, 1);
digitalWrite(G, 0); digitalWrite(H, 0);}
void FG(void) {
digitalWrite(A, 0); digitalWrite(B, 0);
digitalWrite(C, 0); digitalWrite(D, 0);
digitalWrite(E, 0); digitalWrite(F, 1);
digitalWrite(G, 1); digitalWrite(H, 0);}
void GA(void) {
digitalWrite(A, 1); digitalWrite(B, 0);
digitalWrite(C, 0); digitalWrite(D, 0);
digitalWrite(E, 0); digitalWrite(F, 0);
digitalWrite(G, 1); digitalWrite(H, 0);}
void AB(void) {
digitalWrite(A, 1); digitalWrite(B, 1);
digitalWrite(C, 0); digitalWrite(D, 0);
digitalWrite(E, 0); digitalWrite(F, 0);
digitalWrite(G, 0); digitalWrite(H, 0);}
void BC(void) {
digitalWrite(A, 0); digitalWrite(B, 1);
digitalWrite(C, 1); digitalWrite(D, 0);
digitalWrite(E, 0); digitalWrite(F, 0);
digitalWrite(G, 0); digitalWrite(H, 0);}
void loop(void){
CD(); delay(1000); DA(); delay(1000);
AE(); delay(1000); EF(); delay(1000);
FG(); delay(1000); GA(); delay(1000);
AB(); delay(1000); BC(); delay(1000);}
Tinkercad.com saytidagi link:
https://www.tinkercad.com/things/gIMcgbFGeAv-copy-of-arduino-7-segment-display/editel?sharecode=PL_v0k-VkcJ1SxtSLjSLnMHT05NKLS7B-WWIuGSw3tU
3-ishim:
Virtual Arduino qurulmasi, 64ta led lampa va ulagich simlar yordamida 8x8 yorug’lik diodli matritsani yasadim va bu orqali DADAM degan so’zni chiqardim. Buni yaxshilab tushinish uchun link orqali saytda o’zingiz ishlatib ko’rishingiz mumkin.
8x8 diodli matritsani ishlatishning strukturaviy sxemasi (3.1-rasm)
8x8 diodli matritsani ishlatishning elektron sxemasi (3.2-rasm)
Laboratoriya ishining strukturaviy va elektron sxemasi yordamida Tinkercad.com platformasida ishni emulatsion formasi xosil qilinadi (3.3-rasm).
Kod qismi:
#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}};
int D[8][8] = {{1,1,1,1,1,1,1,1}, {1,1,0,0,0,1,1,1}, {1,1,0,1,1,0,1,1},
{1,1,0,1,1,0,1,1}, {1,1,0,1,1,0,1,1}, {1,1,0,1,1,0,1,1},
{1,1,0,0,0,1,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(1000); yaz(D);
delay(1000); yaz(A);
delay(1000); yaz(D);
delay(1000); 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);}
}
Tinkercad.com saytidagi link:
https://www.tinkercad.com/things/fGzwbyEPd6h-brilliant-vihelmo/editel?sharecode=AIs8XTkwudN9BlQaUvMA-qQTsW1IxgLuTjTzsipbx7Y
Xulosa
Men bu laboratoriya ishimizda RGB Led lampasi orqali lampani xohlagan rangimda yoqishni, 7 Segmentli displayda sonlar va ilon izini chiqarishni o’rgandim. 64ta led lampa orqali 8x8 yorug’lik diodli matritsani yasadim.
Do'stlaringiz bilan baham: |