03 PRAKTIKA

download 03 PRAKTIKA

of 2

Transcript of 03 PRAKTIKA

  • 8/10/2019 03 PRAKTIKA

    1/2

    Praktika honetan informazioa bidaliko diogu ordenagailuari irakurri ahal izateko. Aldi bereanpotentziometro batetik datorren seinale analogikoak irakurtzen ikasiko dugu.

    Muntatu potentziometro bat behean agertzen den moduaneta kargatu alboan dagoen sketch-a.

    Potentziometroak 5v-0v arteko seinale bat ematen du eta

    Arduino plakak 102 -0 arteko balioak erabiltzen ditu seinaleanalogiko hori gordetzeko.

    Serial port-ean idatzitako guztia ikusi ahal izateko sakatu Arduino-IDEn aurkitu daitekeen alboko ikurrari.Leiho berri bat zabalduko da non datu guztiak ikusgai izangodituzun.

    POTENCIOMETER a variable resistor !ith three pins. "!o of the pins are connected to the ends of a fi#edresistor. "he middle pin moves across the resistor$ dividing it into t!o halves. %hen the e#ternal sides of thepotentiometer are connected to voltage and ground$ the middle leg !ill give the difference in voltage asturn the knob.

    Description SyntaxSerial.begin() Used for start the communication between the Arduino board and

    a computer or other devices. It opens the serial pot and sets the data rate in bits per second(baud) for serial data transmission.

    Serial.begin (speed)

    speed: in bits per second (baud)

    Serial.print()

    Serial.pintln()

    Prints data to the serial port as human-readable

    Prints data to the serial port as human-readable followed by acarriage return character and a newline character. This commandta es the same forms as !erial.print().

    Serial.print (val)Serial.println (val)

    val " the value to print - any data type

    analogRead() #eads the value from the specified analog pin. The Arduino boardcontains a $ channel% &'-bit analog to digital converter. Thismeans that it will map input voltages between ' and volts intointeger values between ' and &' *. This yields a resolution between readings of" volts + &' , units or% . '', volts (,. m )per unit.

    analogRead (pin)

    pin: the number of the analog inputpin to read from

    analogWrite()

    P/0 1

    /rites an analog value (P/# waves) to a pin. 2an be used to lighta 345 at varying brightnesses or drive a motor at various speeds. After a call to analog/rite()% the pin will generate a steady s6uare wave of the specified duty cycle until the ne7t callto analog/rite().This function wor s on pins *% % $% % &'% and &&. 8ou do not needto call pin0ode() to set the pin as an output before callinganalog/rite().The analog/rite function has nothing whatsoever to do with theanalog pins or the analog#ead function.

    analogWrite (pin% value)

    pin: the pin to write to. value: the duty cycle" between '(always off) and (always on).

    PRAKTIKA 3. Potenciometer

  • 8/10/2019 03 PRAKTIKA

    2/2

    EGITEKOAPotentziometroaren balioaren arabera aldatu &'(ak duen piztu-itzaliabiadura.)orretarako erabili digitalWrite *pin$mode+ eta delay *ms+ .

    ,aiatu orain &'(aren argitasuna aldatzen potentziometroak hartzenduen balioaren arabera. )orretarako erabili beharko duzu Arduinoplakaren 1 $ 1 5$ 1 $ 1 $ 1 10 edo 1 11 P/ ak$ hauek baitira 5v eta 0vartean balioa aldatzeko gai diren bakarrak. analogWrite *pin$ value+ere erabili behar izango duzu.