Перевод статьи "Программирование LEGO NXT роботов на языке NXC"

Материал из roboforum.ru Wiki
Перейти к: навигация, поиск
(перевод статьи "Programming LEGO NXT Robots using NXC")


Исходная статья: [http://bricxcc.sourceforge.net/nbc/nxcdoc/NXC_tutorial.pdf]

Автор: Daniele Benedettelli

Перевод: © Ботов Антон aka =DeaD=, 2009

Эксклюзивно для www.roboforum.ru
копирование на другие ресурсы и публикация перевода
без разрешения его автора запрещены

Содержание:

  • Введение
    • Благодарности
  • Ваша первая программа
    • Постройка робота
    • Запуск Bricx Command Center
    • Написание программы
    • Запуск программы
    • Ошибки в программе
    • Изменяем скорость
    • Подводим итоги
  • A more interesting program _______________________________________________ 10
    • Making turns ________________________________________________________________________ 10
    • Repeating commands _________________________________________________________________ 10
    • Adding comments ____________________________________________________________________ 11
    • Summary___________________________________________________________________________ 12
  • Using variables_________________________________________________________ 13
    • Moving in a spiral ____________________________________________________________________ 13
    • Random numbers ____________________________________________________________________ 14
    • Summary___________________________________________________________________________ 15
  • Control structures_______________________________________________________ 16
    • The if statement______________________________________________________________________ 16
    • The do statement _____________________________________________________________________ 17
    • Summary___________________________________________________________________________ 17
  • Sensors ________________________________________________________________ 18
    • Waiting for a sensor __________________________________________________________________ 18
    • Acting on a touch sensor _______________________________________________________________ 19
    • Light sensor_________________________________________________________________________ 19
    • Sound sensor ________________________________________________________________________ 20
    • Ultrasonic sensor_____________________________________________________________________ 21
    • Summary___________________________________________________________________________ 22
  • Tasks and subroutines ___________________________________________________ 23
    • Tasks ______________________________________________________________________________ 23
    • Subroutines _________________________________________________________________________ 24
    • Defining macros _____________________________________________________________________ 25
    • Summary___________________________________________________________________________ 26
  • Making music _________________________________________________________ 28
    • Playing sound files ___________________________________________________________________ 28
    • Playing music _______________________________________________________________________ 28
    • Summary___________________________________________________________________________ 30
  • More about motors ____________________________________________________ 31
    • Stopping gently ______________________________________________________________________ 31
    • Advanced commands _________________________________________________________________ 31
    • PID control _________________________________________________________________________ 33
    • Summary___________________________________________________________________________ 34
  • More about sensors _____________________________________________________ 35
    • Sensor mode and type _________________________________________________________________ 35
    • The rotation sensor ___________________________________________________________________ 36
    • Putting multiple sensors on one input _____________________________________________________ 37
    • Summary___________________________________________________________________________ 38
  • Parallel tasks ___________________________________________________________ 39
    • A wrong program ____________________________________________________________________ 39
    • Critical sections and mutex variables _____________________________________________________ 39
    • Using semaphores ____________________________________________________________________ 40
    • Summary___________________________________________________________________________ 41
  • Communication between robots ___________________________________________ 42
    • Master – Slave messaging______________________________________________________________ 42
    • Sending numbers with acknowledgement__________________________________________________ 43
    • Direct commands ____________________________________________________________________ 45
    • Summary___________________________________________________________________________ 45
  • More commands _______________________________________________________ 46
    • Timers _____________________________________________________________________________ 46
    • Dot matrix display____________________________________________________________________ 46
    • File system _________________________________________________________________________ 47
    • Summary___________________________________________________________________________ 50
  • Final remarks ________________________________________________________ 51