Вхід до системи

Відмінності між версіями «Програмування»

Матеріал з мікроАмпер
Рядок 204: Рядок 204:
 
|
 
|
 
|
 
|
 +
|<font style="color: #ef553b">Символи</font>
 
|-
 
|-
 
|<font style="color: #ef553b">Вказівники доступу</font>
 
|<font style="color: #ef553b">Вказівники доступу</font>
 +
|
 +
|isAlphaNumeric()
 +
|-
 
|
 
|
 
|
 
|
 +
|isAlpha()
 
|-
 
|-
 +
|* dereference operator
 
|
 
|
 +
|isAscii()
 +
|-
 +
|& reference operator
 
|
 
|
 +
|isWhitespace()
 +
|-
 
|
 
|
 +
|
 +
|isControl()
 
|-
 
|-
|* dereference operator
+
|<font style="color: #ef553b">Бітові оператори</font>
 
|
 
|
 +
|isDigit()
 +
|-
 
|
 
|
 +
|
 +
|isGraph()
 
|-
 
|-
|& reference operator
+
|& (bitwise and)
 
|
 
|
 +
|isLowerCase()
 +
|-
 +
|<nowiki>| (bitwise or)</nowiki>
 
|
 
|
 +
|isPrintable()
 
|-
 
|-
 +
|^ (bitwise xor)
 
|
 
|
 +
|isPunct()
 +
|-
 +
|~ (bitwise not)
 
|
 
|
 +
|isSpace()
 +
|-
 +
|<< (bitshift left)
 
|
 
|
 +
|isUpperCase()
 
|-
 
|-
|<font style="color: #ef553b">Бітові оператори</font>
+
|>> (bitshift right)
 +
|
 +
|isHexadecimalDigit()
 +
|-
 +
|&nbsp;
 
|
 
|
 
|
 
|
 
|-
 
|-
 +
|<font style="color: #ef553b">Складені оператори присвоєння</font>
 
|
 
|
 +
|<font style="color: #ef553b">Випадкові числа</font>
 +
|-
 +
|&nbsp;
 
|
 
|
 
|
 
|
 
|-
 
|-
|& (bitwise and)
+
|<nowiki>++ (increment)</nowiki>
 
|
 
|
 +
|randomSeed()
 +
|-
 +
|<nowiki>-- (decrement)</nowiki>
 
|
 
|
 +
|random()
 
|-
 
|-
|<nowiki>| (bitwise or)</nowiki>
+
|<nowiki>+= (compound addition)</nowiki>
 
|
 
|
 
|
 
|
 
|-
 
|-
|^ (bitwise xor)
+
|<nowiki>-= (compound subtraction)</nowiki>
 +
|
 +
|<font style="color: #ef553b">Біти та байти</font>
 +
|-
 +
|<nowiki>*= (compound multiplication)</nowiki>
 
|
 
|
 
|
 
|
 
|-
 
|-
|~ (bitwise not)
+
|<nowiki>/= (compound division)</nowiki>
 
|
 
|
 +
|lowByte()
 +
|-
 +
|<nowiki>%= (compound modulo)</nowiki>
 
|
 
|
 +
|highByte()
 
|-
 
|-
|<< (bitshift left)
+
|<nowiki>&= (compound bitwise and)</nowiki>
 
|
 
|
 +
|bitRead()
 +
|-
 +
|<nowiki>|= (compound bitwise or)</nowiki>
 
|
 
|
 +
|bitWrite()
 
|-
 
|-
|>> (bitshift right)
 
 
|
 
|
 
|
 
|
 +
|bitSet()
 
|-
 
|-
 
|
 
|
 
|
 
|
 +
|bitClear()
 +
|-
 
|
 
|
 +
|
 +
|bit()
 
|-
 
|-
|<font style="color: #ef553b">Складені оператори присвоєння</font>
 
 
|
 
|
 
|
 
|
 +
|&nbsp;
 
|-
 
|-
 
|
 
|
 +
|
 +
|<font style="color: #ef553b">Зовнішні переривання</font>
 +
|-
 +
|&nbsp;
 
|
 
|
 
|
 
|
 
|-
 
|-
|<nowiki>++ (increment)</nowiki>
 
 
|
 
|
 
|
 
|
 +
|attachInterrupt()
 
|-
 
|-
|<nowiki>-- (decrement)</nowiki>
 
 
|
 
|
 
|
 
|
 +
|detachInterrupt()
 
|-
 
|-
|<nowiki>+= (compound addition)</nowiki>
 
 
|
 
|
 
|
 
|
 +
|&nbsp;
 
|-
 
|-
|<nowiki>-= (compound subtraction)</nowiki>
 
 
|
 
|
 
|
 
|
 +
|<font style="color: #ef553b">Переривання</font>
 
|-
 
|-
|<nowiki>*= (compound multiplication)</nowiki>
+
|&nbsp;
 
|
 
|
 
|
 
|
 
|-
 
|-
|<nowiki>/= (compound division)</nowiki>
 
 
|
 
|
 
|
 
|
 +
|interrupts()
 
|-
 
|-
|<nowiki>%= (compound modulo)</nowiki>
 
 
|
 
|
 
|
 
|
 +
|noInterrupts()
 
|-
 
|-
|<nowiki>&= (compound bitwise and)</nowiki>
 
 
|
 
|
 
|
 
|
 +
|&nbsp;
 
|-
 
|-
|<nowiki>|= (compound bitwise or)</nowiki>
 
 
|
 
|
 +
|
 +
|<font style="color: #ef553b">Комунікація</font>
 
|-
 
|-
 +
|&nbsp;
 
|
 
|
 +
|
 +
|-
 +
|
 +
|
 +
|Serial
 +
|-
 +
|
 +
|
 +
|Stream
 +
|-
 +
|
 +
|
 +
|
 +
|-
 +
|&nbsp;
 +
|
 +
|<font style="color: #ef553b">USB (Лише для Due/Zero та плат на 32u4)</font>
 +
|-
 +
|&nbsp;
 +
|
 +
|
 +
|-
 +
|
 +
|
 +
|Keyboard
 +
|-
 
|
 
|
 
|
 
|
 +
|Mouse
 
|-
 
|-

Версія за 15:41, 22 червня 2016

Мова програмування Arduino має три головні розділи: структура, дані (змінні та константи) і функції.

Структура Дані Функції
    • setup()
  • Константи Цифрове введення/виведення
    loop()
    LOW pinMODE()
    Оператори керування OUTPUT | INPUT_PULLUP digitalWrite()
    LED_BUILTIN digitalRead()
    if false
    if...else integer constants Analog I/O
    for floating point constants
    switch case analogReference()
    while Типи даних analogRead()
    do... while analogWrite() - PWM
    break void
    continue boolean Лише для Due & Zero
    return char
    goto unsigned char analogReadResolution()
    byte analogWriteResolution()
    Синтаксис int
    unsigned int Розширене введення/виведення
    ; (semicolon) word
    {} (curly braces) long tone()
    // (single line comment) unsigned long noTone()
    /* */ (multi-line comment) short shiftOut()
    #define float shiftIn()
    #include double pulseIn()
    string - char array
    Арифметичні оперетори String - object Час
    array
    = (assignment operator) millis()
    + (addition) Перетворення типів micros()
    - (subtraction) delay()
    * (multiplication) char() delayMicroseconds()
    / (division) byte()
    % (modulo) int() Математичні дії
    word()
    Оператори порівняння long() min()
    float() max()
    == (equal to) abs()-
    != (not equal to) Область видимості змінної та специфікатори constrain()
    < (less than) map()
    > (greater than) variable scope pow()
    <= (less than or equal to) static sqrt()
    >= (greater than or equal to) volatile
    const Тригонометрія
    Оператори Boolean
    Допоміжні функції sin()
    && (and) cos()
    || (or) sizeof() tan()
    ! (not) PROGMEM
    Символи
    Вказівники доступу isAlphaNumeric()
    isAlpha()
    * dereference operator isAscii()
    & reference operator isWhitespace()
    isControl()
    Бітові оператори isDigit()
    isGraph()
    & (bitwise and) isLowerCase()
    | (bitwise or) isPrintable()
    ^ (bitwise xor) isPunct()
    ~ (bitwise not) isSpace()
    << (bitshift left) isUpperCase()
    >> (bitshift right) isHexadecimalDigit()
     
    Складені оператори присвоєння Випадкові числа
     
    ++ (increment) randomSeed()
    -- (decrement) random()
    += (compound addition)
    -= (compound subtraction) Біти та байти
    *= (compound multiplication)
    /= (compound division) lowByte()
    %= (compound modulo) highByte()
    &= (compound bitwise and) bitRead()
    |= (compound bitwise or) bitWrite()
    bitSet()
    bitClear()
    bit()
     
    Зовнішні переривання
     
    attachInterrupt()
    detachInterrupt()
     
    Переривання
     
    interrupts()
    noInterrupts()
     
    Комунікація
     
    Serial
    Stream
      USB (Лише для Due/Zero та плат на 32u4)
     
    Keyboard
    Mouse