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 .
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 .
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 .
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 .
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 .
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 .
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 .
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 .
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 .
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 .
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 .
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 .
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 .
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 .
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 .
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 .
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 .
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 .
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 .
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 .
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 .
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 .
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 .
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で作成しますが、より有能な反転アルゴリズムを使用します。
*このソースコードは、 ソースコードハイライターで強調表示されました。
- #in cm
- DEFINE NEAR = 7
- def main():
- DefineSensors(なし、なし、なし、EYES)
- Trueの場合:
- OnFwd(OUT_BC、50)
- SensorVal(4)> NEARの場合:
- 合格する
- オフ(OUT_BC)
- 一方、 SensorVal(4)<NEAR:
- OnFwd(OUT_B、50)
- 待つ(100)
ロボットはその場で向きを変えることを学び、干渉物体が視野から消えるとすぐに前進し続けます。
おそらく既にお気づきのように、Mindstormsのプログラミングは非常に簡単です。 また、PyNXCを使用したNXCとPythonに加えて、Java、Lua、Ruby、Assemblerでコードを記述したり、論理的に他の言語でアセンブラーインサートを使用したりすることもできます。
このすべてのおかげで、子供のおもちゃからのマインドストームは、このギターのような複雑で「スマート」なメカニズムを作成できる非常に強力なものに変わります。
または、このカラーボールソーター:
そして、これらすべての最も良い部分は、必要な部分のほとんどがすでにMindstorms NXT 2.0パッケージに含まれていることです。 本当に必要になる可能性があるのは、たとえば公式のレゴストアで購入できる追加のセンサーだけです。
- レゴマインドストームの公式ウェブサイト
- レゴの公式オンラインストアのマインドストームセクション
- NXTprograms.com-さまざまなモデルを組み立てるための手順が記載されたリソース