• 1.Arduino kontroller to‘plamining tarkibini va imkoniyatlarini o‘rganish. Kompyuterga Arduino IDE ni o‘rnatish.
  • 3.Tugma (Knopka). Yorug‘lik diodini yoqish misolida tugmaning bosilishiga ishlov berish. Titrashga qarshi kurashish. define LED_PIN 8 define BUTTON_PIN 7
  • 4. Potensiometr. Arduino orqali yorug‘lik diodini yorug‘lik darajasini o‘zgartirishini namoyish etish.
  • 5.Potensiometrni xarakatlantirish orqali yonayotgan yorug‘lik diodining sonini o‘zgartirish(Arduinoda).
  • 6. RGB-yorug‘lik diodi. Impuls kengligining modulyatsiyasi.
  • Muhammad al-xozazmiy nomidagi toshkent axborot texnologiyalari universiteti




    Download 7.95 Mb.
    Sana16.05.2023
    Hajmi7.95 Mb.
    #60175
    Bog'liq
    o`rnatilgan tizimlar 1-amaliy
    8-mavzu. Internetda axborot qidiruv tizimlari. Mavzuning maqsadi, Operatsion tizimlar fanidan amaliy (1), operatsion tizim 3-amaliy, 1

    MUHAMMAD AL-XOZAZMIY NOMIDAGI TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI

    TELEKOMMUNIKATSIYA TEXNOLOGIYALARI
    FAKULTET
    O`rnatilgan tizimlar
    1-laboratoriya ishi

    Talaba guruhi: 416-20
    Bajardi: Tilovov Shamsiddin
    Tekshirdi:G’ofurjonov Javohir

    1.Arduino kontroller to‘plamining tarkibini va imkoniyatlarini o‘rganish.
    Kompyuterga Arduino IDE ni o‘rnatish.




    2. Yorug‘lik diodi. Arduino yordamida yorug‘lik diodini o‘chirib yoqish.
    const int LED=9; // 9 (D9) yorug’lik diodini ulash uchun oyoqcha nomeri

    void setup()
    {
    // Yorug’lik diodi ulanadigan oyoqchani chiqish (OUTPUT) deb o’zgartiramiz
    pinMode(LED,OUTPUT);
    }
    voidloop()
    {
    // oyoqchaga (HIGH) mantiqiy 1 berib yorug’lik diodini yoqamiz
    digitalWrite(LED,HIGH);
    //sukut1 sek (1000 ms)
    delay(1000);
    // oyoqchaga (LOW) mantiqiy 0 berib yorug’lik diodini o’chiramiz
    digitalWrite(LED,LOW);
    // sukut 1 sek (1000 ms)
    delay(1000);
    }


    3.Tugma (Knopka). Yorug‘lik diodini yoqish misolida tugmaning bosilishiga ishlov berish. Titrashga qarshi kurashish.
    #define LED_PIN 8
    #define BUTTON_PIN 7
    byte lastButtonState = LOW;
    byte ledState = LOW;
    unsigned long debounceDuration = 50; // millis
    unsigned long lastTimeButtonStateChanged = 0;
    void setup() {
    pinMode(LED_PIN, OUTPUT);
    pinMode(BUTTON_PIN, INPUT);
    }
    void loop() {
    if (millis() - lastTimeButtonStateChanged > debounceDuration) {
    byte buttonState = digitalRead(BUTTON_PIN);
    if (buttonState != lastButtonState) {
    lastTimeButtonStateChanged = millis();
    lastButtonState = buttonState;
    if (buttonState == LOW) {
    ledState = (ledState == HIGH) ? LOW: HIGH;
    digitalWrite(LED_PIN, ledState);
    }
    }
    }
    }



    4. Potensiometr. Arduino orqali yorug‘lik diodini yorug‘lik darajasini o‘zgartirishini namoyish etish.
    #include "Servo.h" // include the servo library
    Servo servo; // declare a servo variable of type "servo"


    void setup () {
    servo. attach (10); // bind servo to port 10
    pinMode (A1, INPUT ); // connect a potentiometer to input A1
    }


    void loop () {
    int val = analogRead (A1); // read data from port A1
    val = map (val, 0, 1023, 0, 180); // translate val into a new range
    servo. write (val); // pass values ​​for the servo
    }



    5.Potensiometrni xarakatlantirish orqali yonayotgan yorug‘lik diodining sonini o‘zgartirish(Arduinoda).
    #define PIN_LED 11
    #define PIN_POT A0
    void setup()
    {
    // The pin to which the LED is connected is defined as an output
    pinMode(PIN_LED, OUTPUT);
    // Variable Resistor Pin Is Input
    pinMode(PIN_POT, INPUT);
    }
    void loop(){
    // Define 2 variables of type int
    int rotat, brightn;
    // Reading the voltage from the variable resistor into the rotat variable:
    // the microcontroller will output numbers from 0 to 1023
    // proportional to the rotation position of the shaft
    rotat = analogRead(PIN_POT);
    // Convert value to brightness. To do this, we divide rotat by 4, which, taking into account rounding, will give us a number from 0 to 255. It is this number that we will feed to the PWM output, with which you can control the brightness.

    brightn=rotat/4;


    // Write PWM brightness value to LED
    analogWrite(PIN_LED, brightn);
    }

    6. RGB-yorug‘lik diodi. Impuls kengligining modulyatsiyasi.
    /*
    * Created by ArduinoGetStarted.com
    *
    * This example code is in the public domain
    *
    * Tutorial page: https://arduinogetstarted.com/tutorials/arduino-rgb-led
    */

    const int PIN_RED = 5;


    const int PIN_GREEN = 6;
    const int PIN_BLUE = 7;

    void setup() {


    pinMode(PIN_RED, OUTPUT);
    pinMode(PIN_GREEN, OUTPUT);
    pinMode(PIN_BLUE, OUTPUT);
    }

    void loop() {


    // color code #00C9CC (R = 0, G = 201, B = 204)
    analogWrite(PIN_RED, 0);
    analogWrite(PIN_GREEN, 201);
    analogWrite(PIN_BLUE, 204);

    delay(1000); // keep the color 1 second

    // color code #F7788A (R = 247, G = 120, B = 138)
    analogWrite(PIN_RED, 247);
    analogWrite(PIN_GREEN, 120);
    analogWrite(PIN_BLUE, 138);

    delay(1000); // keep the color 1 second

    // color code #34A853 (R = 52, G = 168, B = 83)
    analogWrite(PIN_RED, 52);
    analogWrite(PIN_GREEN, 168);
    analogWrite(PIN_BLUE, 83);

    delay(1000); // keep the color 1 second


    }


    Download 7.95 Mb.




    Download 7.95 Mb.

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    Muhammad al-xozazmiy nomidagi toshkent axborot texnologiyalari universiteti

    Download 7.95 Mb.