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

Програмування

Матеріал з мікроАмпер

Мова програмування 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
    Вказівники доступу
    * dereference operator
    & reference operator
    Бітові оператори
    & (bitwise and)
    | (bitwise or)
    ^ (bitwise xor)
    ~ (bitwise not)
    << (bitshift left)
    >> (bitshift right)
    Складені оператори присвоєння
    ++ (increment)