Laboratoriya mashg‘uloti №7 Mavzu: 7 segmentli led monitor bilan ishlash Ishdan maqsad
Download 45.7 Kb.
|
1 2
Bog'liq7-laboratoriya
- Bu sahifa navigatsiya:
- Kerakli jixozlar
- Dasturdan foydalanish
- C++ dasturlash muhitda dastur yozish
Laboratoriya mashg‘uloti № 7 Mavzu: 7 segmentli LED monitor bilan ishlash Ishdan maqsad: Arduino qurilmasi orqali qanday texnik qulay imkoniyatlarni va xayotimizda texnik ish unumdorligini oshirish uchun Arduino qurilmasini o‘rganib chiqamiz. Kerakli jixozlar: Arduino plata qurilmasi. Breadboard. USB Kabel. Kerakli ehtiyot qismlari. Jixozlarning vazifalari: Arduino plata qurilmasi. Istalgan kerakli qurilmalarni tizimlashtirish imkoniyatiga ega va avtomatik tarzda ishlash xususiyatlariga ega. Breadboard. Ehtiyot qismlarini o‘rnatish platasi ya’ni (zapchast) larni o‘rnatish uchun va qurilmani tizim orqali tekshirib ko‘rishimiz uchun kerak bo‘ladi. USB Kabel. Bu kabellar Arduino qurilmasini kompyuterga ulash uchun foydalanamiz. Kerakli ehtiyot qismlari. Masalan led(svetodiod), diod(diod) va x.k.z. 1-rasm 7 segmentli led monitorning tashqi ko’rinishi. Dasturdan foydalanish: Arduino qurilmasi barcha qurilmalarni avtomatlashtirish uchun mo‘ljallangan va u qo‘llanishda ko‘p qulayliklarga ega. Foydalanuvchi kod bilan ehtiyot qisimlarni o‘ziga moslashtira oladi. Arduino qurilmasi oddiy va sodda ko‘rinishga ega bulgani bilan juda ko‘p funksiyalarga ega. Dasturni ayniqsa C++ dasturlash tili orqali amalga oshirishi kerak bo‘ladi. Yozilgan dastur asosan bitta Atmega 328 kontrolleriga o‘rnatib Arduino qurilmasida amaliy natijani ko‘rish mumkin. C++ dasturlash muhitda dastur yozish intpinA=2; intpinB=3; intpinC=4; intpinD=5; intpinE=6; intpinF=7; intpinG=8; intD1=9; intD2=10; intD3=11; intD4=12; // the setup routine runs once when you press reset: voidsetup() { // initialize the digital pins as outputs. pinMode(pinA, OUTPUT); pinMode(pinB, OUTPUT); pinMode(pinC, OUTPUT); pinMode(pinD, OUTPUT); pinMode(pinE, OUTPUT); pinMode(pinF, OUTPUT); pinMode(pinG, OUTPUT); pinMode(D1, OUTPUT); pinMode(D2, OUTPUT); pinMode(D3, OUTPUT); pinMode(D4, OUTPUT); } // the loop routine runs over and over again forever: voidloop() { digitalWrite(D1, HIGH); digitalWrite(D2, LOW); digitalWrite(D3, LOW); digitalWrite(D4, LOW); //0 digitalWrite(pinA, LOW); digitalWrite(pinB, HIGH); digitalWrite(pinC, LOW); digitalWrite(pinD, LOW); digitalWrite(pinE, HIGH); digitalWrite(pinF, LOW); digitalWrite(pinG, LOW); delay(1); // wait for a second digitalWrite(D1, LOW); digitalWrite(D2, HIGH); digitalWrite(D3, LOW); digitalWrite(D4, LOW); //1 digitalWrite(pinA, LOW); digitalWrite(pinB, LOW); digitalWrite(pinC, LOW); digitalWrite(pinD, HIGH); digitalWrite(pinE, LOW); digitalWrite(pinF, LOW); digitalWrite(pinG, LOW); delay(1); // wait for a second digitalWrite(D1, LOW); digitalWrite(D2, LOW); digitalWrite(D3, HIGH); digitalWrite(D4, LOW); //2 digitalWrite(pinA, HIGH); digitalWrite(pinB, HIGH); digitalWrite(pinC, LOW); digitalWrite(pinD, HIGH); digitalWrite(pinE, LOW); digitalWrite(pinF, HIGH); digitalWrite(pinG, LOW); delay(1); // wait for a second digitalWrite(D1, LOW); digitalWrite(D2, LOW); digitalWrite(D3, LOW); digitalWrite(D4, HIGH); //3 digitalWrite(pinA, LOW); digitalWrite(pinB, HIGH); digitalWrite(pinC, LOW); digitalWrite(pinD, HIGH); digitalWrite(pinE, LOW); digitalWrite(pinF, LOW); digitalWrite(pinG, HIGH); delay(1); // wait for a second /* //4 digitalWrite(pinA, HIGH); digitalWrite(pinB, LOW); digitalWrite(pinC, LOW); digitalWrite(pinD, HIGH); digitalWrite(pinE, HIGH); digitalWrite(pinF, LOW); digitalWrite(pinG, LOW); delay(1000); // wait for a second //5 digitalWrite(pinA, LOW); digitalWrite(pinB, HIGH); digitalWrite(pinC, LOW); digitalWrite(pinD, LOW); digitalWrite(pinE, HIGH); digitalWrite(pinF, LOW); digitalWrite(pinG, LOW); delay(1000); // wait for a second //6 digitalWrite(pinA, LOW); digitalWrite(pinB, HIGH); digitalWrite(pinC, LOW); digitalWrite(pinD, LOW); digitalWrite(pinE, LOW); digitalWrite(pinF, LOW); digitalWrite(pinG, LOW); delay(1000); // wait for a second //7 digitalWrite(pinA, LOW); digitalWrite(pinB, LOW); digitalWrite(pinC, LOW); digitalWrite(pinD, HIGH); digitalWrite(pinE, HIGH); digitalWrite(pinF, HIGH); digitalWrite(pinG, HIGH); delay(1000); // wait for a second //8 digitalWrite(pinA, LOW); digitalWrite(pinB, LOW); digitalWrite(pinC, LOW); digitalWrite(pinD, LOW); digitalWrite(pinE, LOW); digitalWrite(pinF, LOW); digitalWrite(pinG, LOW); delay(1000); // wait for a second //9 digitalWrite(pinA, LOW); digitalWrite(pinB, LOW); digitalWrite(pinC, LOW); digitalWrite(pinD, HIGH); digitalWrite(pinE, HIGH); digitalWrite(pinF, LOW); digitalWrite(pinG, LOW); delay(1000); // wait for a second */ } Download 45.7 Kb. Do'stlaringiz bilan baham: |
1 2
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling