Dastur kodi:
#define minus1 0
#define minus2 1
#define minus3 2
#define rot1 3
#define rot2 4
#define rot3 5
#define blau1 6
#define blau2 7
#define blau3 8
#define gruen1 9
#define gruen2 10
#define gruen3 11
#define pM pinMode
#define dW digitalWrite
#define zeit delay(100)
void setup()
{
pM(minus1, OUTPUT);
pM(minus2, OUTPUT);
pM(minus3, OUTPUT);
pM(rot1, OUTPUT);
pM(rot2, OUTPUT);
pM(rot3, OUTPUT);
pM(blau1, OUTPUT);
pM(blau2, OUTPUT);
pM(blau3, OUTPUT);
pM(gruen1, OUTPUT);
pM(gruen2, OUTPUT);
pM(gruen3, OUTPUT);
dW(minus1, HIGH);
dW(minus2, HIGH);
dW(minus3, HIGH);
dW(rot1, LOW);
dW(rot2, LOW);
dW(rot3, LOW);
dW(blau1, LOW);
dW(blau2, LOW);
dW(blau3, LOW);
dW(gruen1, LOW);
dW(gruen2, LOW);
dW(gruen3, LOW);
}
void loop()
{
dW(minus1, LOW);
dW(rot1, HIGH);
zeit;
dW(rot1, LOW);
dW(rot2, HIGH);
zeit;
dW(rot2, LOW);
dW(rot3, HIGH);
zeit;
dW(rot3, LOW);
dW(minus1, HIGH);
dW(minus2, LOW);
dW(rot1, HIGH);
zeit;
dW(rot1, LOW);
dW(rot2, HIGH);
zeit;
dW(rot2, LOW);
dW(rot3, HIGH);
zeit;
dW(rot3, LOW);
dW(minus2, HIGH);
dW(minus3, LOW);
dW(rot1, HIGH);
zeit;
dW(rot1, LOW);
dW(rot2, HIGH);
zeit;
dW(rot2, LOW);
dW(rot3, HIGH);
zeit;
dW(rot3, LOW);
dW(minus3, HIGH);
dW(minus1, LOW);
dW(blau1, HIGH);
zeit;
dW(blau1, LOW);
dW(blau2, HIGH);
zeit;
dW(blau2, LOW);
dW(blau3, HIGH);
zeit;
dW(blau3, LOW);
dW(minus1, HIGH);
dW(minus2, LOW);
dW(blau1, HIGH);
zeit;
dW(blau1, LOW);
dW(blau2, HIGH);
zeit;
dW(blau2, LOW);
dW(blau3, HIGH);
zeit;
dW(blau3, LOW);
dW(minus2, HIGH);
dW(minus3, LOW);
dW(blau1, HIGH);
zeit;
dW(blau1, LOW);
dW(blau2, HIGH);
zeit;
dW(blau2, LOW);
dW(blau3, HIGH);
zeit;
dW(blau3, LOW);
dW(minus3, HIGH);
dW(minus1, LOW);
dW(gruen1, HIGH);
zeit;
dW(gruen1, LOW);
dW(gruen2, HIGH);
zeit;
dW(gruen2, LOW);
dW(gruen3, HIGH);
zeit;
dW(gruen3, LOW);
dW(minus1, HIGH);
dW(minus2, LOW);
dW(gruen1, HIGH);
zeit;
dW(gruen1, LOW);
dW(gruen2, HIGH);
zeit;
dW(gruen2, LOW);
dW(gruen3, HIGH);
zeit;
dW(gruen3, LOW);
dW(minus2, HIGH);
dW(minus3, LOW);
dW(gruen1, HIGH);
zeit;
dW(gruen1, LOW);
dW(gruen2, HIGH);
zeit;
dW(gruen2, LOW);
dW(gruen3, HIGH);
zeit;
dW(gruen3, LOW);
dW(minus3, HIGH);
}
Yig’ilgan sxemani quyidagi havola orqali ko’rishingiz mumkin:
https://www.tinkercad.com/things/0WUqfPsyHar-copy-of-rgb-matrix/editel?sharecode=DrgLM9DcOx2j5xOKBuJohlv-VTDXtZL8yPvZIurv4RU
2-ish::::Rgb da random rgb
1-qadam. Laboratoriya ishini bajarish uchun ulanish sxemasi tashkil qilamiz. Birinchi navbatda led lampalarni ulashning strukturaviy sxemasi chiziladi (1.1-chizmada keltirilgan).
1.1-chizma. Led lampalarni ulashning strukturaviy sxemasi.
2-qadam. Bu qadamda laboratoriya ishini amaliyotda qo’llash uchun elektron sxemasi chizamiz (1.2-chizmada keltirilgan).
3-qadam. Laboratoriya ishining strukturaviy va elektron sxemasi yordamida Tinkercad.com platformasida ishni emulatsion formasini xosil qilamiz(1.3-chizma).
1.3-chizma. RGB lampalarni ulashning emulatsion holati.
Dastur kodi:
int On = 0;
void setup(){
pinMode(3, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
}void loop(){
On = 0;
while (On == 0) {
analogWrite(3, random(0, 255 + 1));
analogWrite(5, random(0, 255 + 1));
analogWrite(6, random(0, 255 + 1));
analogWrite(9, random(0, 255 + 1));
analogWrite(10, random(0, 255 + 1));
}
delay(10);
Xulosa: LEDlar elektr tokini yetkazib berish turiga qarab turli ranglarda yonadi. Agar siz bir vaqtning o‘zida 3 ta rangli LEDga quvvat qo‘ysangiz, kristallar oqarib ketadi. Arduino RGB rang sxemasini sozlash uchun masofadan boshqarish pulti bilan boshqaruvchilar ishlatiladi. Ular 3 ta dala effektli tranzistorlar va mikroprotsessordan iborat. Ushbu armatura sizga LEDlarning rangli gamutini uzoq masofada sozlash imkonini beradi. Boshqarish paneli bilan boshqaruvchilarning ishlashi Arduino dasturiy muhitida yozilgan eskizlar yordamida ta'minlanadi.
2-topshiriq.
Yetti segmentli bitta raqamli ko‘rsatkich.
Ishdan maqsad : Yetti segmentli bir xonali ko‘rsatkich bilan tanishish va uni loyihalarda qo‘llash.
Kerakli komponentlar:
Quyida keltirilgan kerakli komponentlar va elementlar virtual platformada mavjud va ulardan foydalaniladi.
-RGB lampa
-Svetodiod
-Rezistor
-Arduino Uno R3
-Plata maketi
-Knopka
Nazariy qism
Yetti segmentli LED indikatori-bu raqamli ma'lumotlarni ko‘rsatish qurilmasi. Bu arab raqamlarini ko‘rsatadigan ko‘rsatkichning eng oddiy qo‘llanilishi. Harflarni ko‘rsatish uchun murakkabroq ko‘p segmentli va matritsali ko‘rsatkichlardan foydalaniladi.Yetti segmentli LED indikatori, nomidan ko‘rinib turibdiki, ettita displey elementidan (segmentlardan) iborat bo‘lib, ularni alohida-alohida yoqish va o‘chirish mumkin. Ularni turli kombinatsiyalarga qo‘shib, siz ulardan arab raqamlarining soddalashtirilgantasvirlariniyasashingizmumkin.Segmentlar A dan G gacha bo‘lgan harflar bilan belgilanadi; sakkizinchi segment - kasr sonlarni ko‘rsatish uchun o‘nlik nuqta (DP).Ba'zida harflar yetti segmentli displeyda ko‘rsatiladi.
Do'stlaringiz bilan baham: |