Lego Mindstorms NXT 2.0-簡単な紹介



10〜11年のコマーシャル。レゴコンストラクターとの長い間のんきな遊びの後、電子工学、電気工学、さらにはプログラミングの専門知識がなくても本物のロボットを作成できるマインドストームの素晴らしいセットの存在を知りました。 私はすぐにこのシリーズに興味を持ちましたが、さまざまな(主に金銭的な)理由でマインドストームを所有するという私の夢は実現することはありませんでした。

今、私は20歳で、私の記念日を記念して、友人たちに感謝します(子供たちに感謝します!) 確かに、今回はすべてが私の子供時代の考えよりも深刻です-私たちは本当にDebian GNU / Linuxの下でMindstormをプログラムします。





これは何?





Mindstorms NXT 2.0はMindstormsシリーズの3番目の製品です。プログラム可能なロボットを作成するために設計された特別なレゴコンストラクターシリーズです。 デザイナーは、従来のレゴテクニックシリーズのパーツのセット、特殊なセンサー(距離、光、タッチ)、いくつかのタコメーターエンジン、特殊なNXTユニットを備えています。 マインドストームの詳細については、 この記事をご覧ください

NXTと言えば、この小さなボックスには、32ビットARM7および8ビットAVR、512 MB RAM、256 KB以上のフラッシュメモリ、モノクロLCDディスプレイ、スピーカー、USBポート、7ポートの2つのマイクロコントローラーが隠れています。センサー接続用。 そして、はい-6個のバッテリーまたはバッテリー用のコンパートメントもあります。これらは、サイトshop.lego.comで個別に販売されています。 実際、NXTは作成されたロボットの「心臓」です。

キットに含まれている簡単なガイドをよく理解しておけば、プログラミングをまったく行わずにいくつかの簡単なアクションを実行するロボットを作成できます。 たとえば、アセンブリを使用して文字通り40分で、部屋の中を移動し、障害物を慎重に回避するロボットを作成できます。 これは、コンピューターに接続せずに、内蔵のモノクロディスプレイでデバイス自体で直接行われます。







悪くないでしょ?

実際、このロボットは私たちの主要なテストモデルになります。 しかし、私たちは彼のスキルを少し改善しようとします。 このために、小さなコードを作成します。





そしてどうやって?



本当に。 バンドルされたソフトウェアは、WindowsおよびMac OSでのみ動作します。 そして、突然Debian Squeezeができました。 幸いなことに、Mindstormsにはこの問題の解決策を思いついた巨大なファンコミュニティがあります。ロボット、特にBricxccをプログラミングするための代替ソフトウェアの使用です( ここにすべてをセットアップするための完全なマニュアルがあります)。

そして今、ちょっとした理論-マインドストームのプログラミングでは、原則として、WindowsおよびMac OSの視覚環境ROBOLABに加えて、RCX言語が使用されますが、ファンの間で最も人気のある言語の1つはかなり単純なNXC(eXactly Cではありません)です。 単純なNXCプログラムは次のようになります。

task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  1. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  2. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  3. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  4. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  5. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  6. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  7. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  8. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  9. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  10. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  11. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  12. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  13. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  14. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  15. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  16. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  17. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  18. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  19. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  20. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  21. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  22. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  23. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  24. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  25. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  26. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  27. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  28. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  29. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  30. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  31. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  32. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  33. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  34. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  35. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  36. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  37. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  38. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  39. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  40. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  41. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  42. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  43. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



  44. task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .



task music() { int lastTone=5000; while ( true ) { int tone= Random (5000)+500; int duration= Random (500); PlayTone(tone,duration); Wait(duration); } } task main() { start music; while ( true ) { /* Determine Next Action */ unsigned int duration= Random (5000); unsigned int motorSpeed= Random (100); unsigned int syncMode= Random (3); /* Display Next Action */ ClearScreen(); NumOut(0,LCD_LINE1,duration); NumOut(0,LCD_LINE2,motorSpeed); NumOut(0,LCD_LINE3,syncMode); /* Perform Next Action */ switch (syncMode) { case 0: OnFwdReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 1: OnRevReg(OUT_AC,motorSpeed,OUT_REGMODE_SYNC); break ; case 2: OnFwdSync(OUT_AC,motorSpeed,-100); break ; case 3: OnRevSync(OUT_AC,motorSpeed,-100); break ; } Wait(duration); } } * This source code was highlighted with Source Code Highlighter .





参考のために-このプログラムは、音楽に似たものにロボットを「ダンス」させます。



私は議論しません、プログラムはまったく理解するのが難しくなく、むしろ扱いにくいです。 また、 NXCでコードを記述する代わりに、特別なPyNXCコンバーターを使用して大幅に簡素化できます。 つまり、Pythonでコードを記述し、PyNXCがそれをNXCコードに変換してデバイスにダウンロードするため、Cのような面倒なコードを記述する必要がなくなります。





私たちはプログラムを書いています!



さて、実際には、透明なカップの間でロボットを移動するためのプログラムをPythonで作成しますが、より有能な反転アルゴリズムを使用します。





  1. #in cm
  2. DEFINE NEAR = 7
  3. def main():
  4. DefineSensors(なし、なし、なし、EYES)
  5. Trueの場合:
  6. OnFwd(OUT_BC、50)
  7. SensorVal(4)> NEARの場合:
  8. 合格する
  9. オフ(OUT_BC)
  10. 一方、 SensorVal(4)<NEAR:
  11. OnFwd(OUT_B、50)
  12. 待つ(100)
*このソースコードは、 ソースコードハイライターで強調表示されました。


ロボットはその場で向きを変えることを学び、干渉物体が視野から消えるとすぐに前進し続けます。



おそらく既にお気づきのように、Mindstormsのプログラミングは非常に簡単です。 また、PyNXCを使用したNXCとPythonに加えて、Java、Lua、Ruby、Assemblerでコードを記述したり、論理的に他の言語でアセンブラーインサートを使用したりすることもできます。

このすべてのおかげで、子供のおもちゃからのマインドストームは、このギターのような複雑で「スマート」なメカニズムを作成できる非常に強力なものに変わります。







または、このカラーボールソーター:







そして、これらすべての最も良い部分は、必要な部分のほとんどがすでにMindstorms NXT 2.0パッケージに含まれていることです。 本当に必要になる可能性があるのは、たとえば公式のレゴストアで購入できる追加のセンサーだけです。




All Articles