|
Guruh talabasi Kalandarov Sunatilla
|
bet | 2/6 | Sana | 20.12.2023 | Hajmi | 3,21 Mb. | | #125223 |
Bog'liq Kalandarov SJihozlarning vazifalari:
Arduino platasi. Istalgan kerakli qurilmalarni tizimlashtirish imkoniyatiga ega va avtomatik tarzda ishlash xususiyatlari mavjud.
Breadboard. Ehtiyot qismlarini o‘rnatish platasi va qurilmani tizim orqali tekshirib ko‘rishimiz uchun kerak bo‘ladi.
Kerakli ehtiyot qismlari. Masalan LED, Rezistor va x.k.z.
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 bo’lgani 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.
1-rasm.LED lampa tuzilishi
const int led1=8;
const int led2=7;
const int led3=6;
const int led4=12;
const int led5=13;
void setup() {
//
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
}
void loop()
{
digitalWrite (led1, 1);
digitalWrite (led2, 0);
digitalWrite (led3, 0);
digitalWrite (led4, 0);
digitalWrite (led5, 0);
delay(300);
digitalWrite (led1, 0);
digitalWrite (led2, 1);
digitalWrite (led3, 0);
digitalWrite (led4, 0);
digitalWrite (led5, 0);
delay(300);
digitalWrite (led1, 0);
digitalWrite (led2, 0);
digitalWrite (led3, 1);
digitalWrite (led4, 0);
digitalWrite (led5, 0);
delay(300);
digitalWrite (led1, 0);
digitalWrite (led2, 0);
digitalWrite (led3, 0);
digitalWrite (led4, 1);
digitalWrite (led5, 0);
delay(300);
digitalWrite (led1, 0);
digitalWrite (led2, 0);
digitalWrite (led3, 0);
digitalWrite (led4, 0);
digitalWrite (led5, 1);
delay(300);
}
|
| |