Перевод статьи "Программирование LEGO NXT роботов на языке NXC" — различия между версиями
=DeaD= (обсуждение | вклад) |
=DeaD= (обсуждение | вклад) |
||
Строка 6: | Строка 6: | ||
<p align=center><b>Автор: Daniele Benedettelli</b><br><br><i>Перевод: © Ботов Антон aka =DeaD=, 2009<br><br>Эксклюзивно для www.roboforum.ru<br> копирование на другие ресурсы и публикация перевода<br>без разрешения его автора запрещены</i></p> | <p align=center><b>Автор: Daniele Benedettelli</b><br><br><i>Перевод: © Ботов Антон aka =DeaD=, 2009<br><br>Эксклюзивно для www.roboforum.ru<br> копирование на другие ресурсы и публикация перевода<br>без разрешения его автора запрещены</i></p> | ||
− | + | Содержание: | |
− | + | * [[Введение]]Preface ___________________________________________________________________ 2 | |
− | + | ** Acknowledgements____________________________________________________________________ 2 | |
− | + | * Writing your first program __________________________________________________ 5 | |
− | + | **Building a robot ______________________________________________________________________ 5 | |
− | + | **Starting Bricx Command Center __________________________________________________________ 5 | |
− | + | **Writing the program ___________________________________________________________________ 6 | |
− | + | **Running the program __________________________________________________________________ 7 | |
− | + | **Errors in your program _________________________________________________________________ 8 | |
− | + | **Changing the speed ____________________________________________________________________ 8 | |
− | + | **Summary____________________________________________________________________________ 9 | |
− | + | *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 |
Версия 13:13, 16 мая 2009
Автор: Daniele Benedettelli
Перевод: © Ботов Антон aka =DeaD=, 2009
Эксклюзивно для www.roboforum.ru
копирование на другие ресурсы и публикация перевода
без разрешения его автора запрещены
Содержание:
- ВведениеPreface ___________________________________________________________________ 2
- Acknowledgements____________________________________________________________________ 2
- Writing your first program __________________________________________________ 5
- Building a robot ______________________________________________________________________ 5
- Starting Bricx Command Center __________________________________________________________ 5
- Writing the program ___________________________________________________________________ 6
- Running the program __________________________________________________________________ 7
- Errors in your program _________________________________________________________________ 8
- Changing the speed ____________________________________________________________________ 8
- Summary____________________________________________________________________________ 9
- 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