ユーザ用ツール

サイト用ツール


dsair2_basic

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン前のリビジョン
次のリビジョン
前のリビジョン
dsair2_basic [2019/02/16 20:02]
– [Speed based Announce example] yaasan
dsair2_basic [2023/09/02 11:01] (現在)
– [DSair BASIC (DSbasic)] yaasan
行 1: 行 1:
 ====== DSair BASIC (DSbasic) ====== ====== DSair BASIC (DSbasic) ======
  
-[[DSair2_ukeng]]+Keywords: BASIC, Programming, プログラミング, 教育, Education, Maker, DIY, interpreter, 
 + 
 +【お知らせ】DSbasicはバグ報告は受け付けますが、使用方法については一切サポートしません。 
 + 
 +[[DSair2_ukeng]] ([[DSair2|JPN]])
  
 DSbasic is a very easy programming solution on your smartphone! This function works in DSair2's webapp on your browser.\\  DSbasic is a very easy programming solution on your smartphone! This function works in DSair2's webapp on your browser.\\ 
-DSbasicは、スマートフォン(Android,iOS)上で動作する、鉄道模型制御向けに最適化されたBASIC開発環境です。命令を打ち込んで実行するだけで、お好きな自動運転や、運転支援機能を実現できます。+DSbasicは、スマートフォン(Android,iOS)上で動作する、鉄道模型制御向けに最適化されたBASIC開発環境です。命令を打ち込んで実行するだけで、お好きな自動運転や、運転支援機能を実現できます。BASICファイルは、SDカードに置けば、ファイル一覧からロードできます。修正したプログラムは、スマホのメモリに保存できます。
  
-{{http://buin2gou.sakura.ne.jp/sblo_files/powerele/image/flashair_28Pixel20229-thumbnail2.png}}\\  +{{http://buin2gou.sakura.ne.jp/sblo_files/powerele/image/DSbasic_21-thumbnail2.png}}\\  
-[[http://buin2gou.sakura.ne.jp/sblo_files/powerele/image/flashair_28Pixel20229.png|Large Image]]+[[http://buin2gou.sakura.ne.jp/sblo_files/powerele/image/DSbasic_21.png|Large Image]]
  
  
行 20: 行 24:
   * Support Locomotive and Turnouts control via BASIC language   * Support Locomotive and Turnouts control via BASIC language
   * MP3 Play suported in MP3 files of FlashAir SD card.   * MP3 Play suported in MP3 files of FlashAir SD card.
-===== Function =====+===== BASIC Function ===== 
 + 
 +==== DSair2 Unique Functions ====
  
 LocAddr is Locomotive address. Default protocol is DCC. If you want to control Marklin's, configure protocol on web app. LocAddr is Locomotive address. Default protocol is DCC. If you want to control Marklin's, configure protocol on web app.
行 30: 行 36:
 |ACC| AccAddr, Direction| diverse=0, straight=1 | |ACC| AccAddr, Direction| diverse=0, straight=1 |
 |DIR| LocAddr, Direction| FWD=1, REV=2 | |DIR| LocAddr, Direction| FWD=1, REV=2 |
-|FNC| LocAddr, FuncNo, FuncON/OFF| FuncNo=0-28 | +|FNC| LocAddr, FuncNo, FuncON/OFF| FuncNo=0-28, FuncON/OFF=0(OFF) or 1(ON) 
-|FNX| LocAddr, FuncNo| FuncNo=0-28 |+|FNX| LocAddr, FuncNo| FuncNo=0-28,ファンクションのOFF->ON->ON操作をします。 |
 |MP3PLAY| FileName with Path | MP3PLAY "Horn.mp3"  | |MP3PLAY| FileName with Path | MP3PLAY "Horn.mp3"  |
 |MP3STOP| - | MP3STOP | |MP3STOP| - | MP3STOP |
-|GETACC| AccAddr(1-2044) | |+|GETACC| AccAddr(1-2044) |指定アドレスのポイント状態(0=div, or 1=str)を返します。 | 
 +|GETACCW| AccAddr(1-2044) |指定アドレス以降16個分のポイント状態(0=div, or 1=str)を返します。 |
 |getslotaddr| SlotNo(0-3) | 4つのユーザー指定アドレススロットからアドレスを取得します。 | |getslotaddr| SlotNo(0-3) | 4つのユーザー指定アドレススロットからアドレスを取得します。 |
-|S88START| - | | +|getslotspd| SlotNo(0-3) | 4つのユーザー指定アドレススロットから速度を取得します。 | 
-|S88GET| S88Sensor address(1-16) | Supported 1 S88 decoder +|getslotfnc| SlotNo(0-3), FuncNo(0-28) | 4つのユーザー指定アドレススロットからファンクション状態(0=OFF,1=ON)を返します。 | 
-|DCPWM| PWMDuty(0-1203) | |+|getslotfncw| SlotNo(0-3) | 4つのユーザー指定アドレススロットからファンクション状態を29bit分返します。 | 
 +|S88START| - | S88機能を有効にします。S88の関数を使う場合は必ずBASICプログラムの最初に記述して下さい。括弧はつけないでください。 
 +|S88GET,GETS88| S88Sensor address(1-16) | S88センサーの値(0=OFF,1=ON)を返します。 | 
 +|GETS88W| S88Sensor address(1-16) | S88センサーの値を16bit分返します。 
 +|DCPWM| PWMDuty(0-1023) | 
 +|DCDIR| Direction| FWD=1, REV=2 |
  
 The parameters of function mean as the followings.\\  The parameters of function mean as the followings.\\ 
行 51: 行 63:
 BASIC functions are described in [[https://github.com/google/wwwbasic|wwwbasic]] user manual. BASIC functions are described in [[https://github.com/google/wwwbasic|wwwbasic]] user manual.
  
-==== BASIC functions ====+==== Main functions ====
  
-FOR,NEXT,IF,GOTO,END IF,ELSE,WHILE,WEND, +  * FOR 
-PRINT,COLOR,LOCATE,LINE,PAINT +  * NEXT 
-RND,INT,SLEEP+  * IF 
 +  * GOTO 
 +  * END IF 
 +  * ELSE 
 +  * WHILE 
 +  * WEND 
 +  * CALL 
 +  
  
 +==== Drawing functions ====
 +
 +  * PRINT
 +  * COLOR
 +  * LOCATE
 +  * LINE
 +  * PAINT
 +  * CIRCLE
 +  * PUT
 +  * SCREEN
 +  * CLS
 +  * WIDTH
 +  * PALETTE
 +  * 
 +
 +==== Math functions ====
 +
 +asc, sqr, int, cint
 +abs, cos, sin, tan
 +atn, exp, log, rnd, atan2
 +
 +==== Text functions ====
 +
 +  * val 文字を数値に変換
 +  * str$  数値を文字列に変換
 +  * ltrim$ 左側文字列を抜き出す
 +  * rtrim$ 右側文字列を抜き出す
 +  * left$
 +  * right$
 +  * mid$
 +  * string$
 +  * space$ スペースを抜き出す
 +  * tab
 +  * ucase$ 英字を大文字にする
 +  * lcase$ 英字を小文字にする
 +  * mid$
 +  * 
 +
 +
 +
 +==== Key Input functions ====
 +
 +  * inkey$
 +  * input
 +
 +==== Mouse Input functions ====
 +
 +  * getmouse
 +  * 
 +
 +==== Etc functions ====
 +
 +  * timer
 +  * SLEEP
 +  * swap
 +  * 
 ===== Examples ===== ===== Examples =====
  
行 148: 行 223:
 ==== S88 decoder example ==== ==== S88 decoder example ====
  
-S88デコーダのセンサデータを取得するサンプルです。+S88デコーダのセンサデータを取得し、Roco BR621(Addr.3)の往復運転を行うサンプルです。 
 + 
 +Detail: [[http://powerele.sblo.jp/article/185548716.html|DSair2で自動運転をしてみる]]
  
 <code> <code>
 +screen(7)
 s88start s88start
-testb = getacc(1) + 
-test = s88get(1) +pwr 
-print s88get(2) +print "START S88 Control" 
-print s88get(3) + 
-print s88get(4) +dir 3,
-print s88get(5+fnc 3,0,1 
-print s88get(6) +fnc 3,1,1 
-print s88get(7) +fnx 3,
-print s88get(8) +spd 3,200 
-print s88get(9) + 
-print s88get(10) +while s88get(1)=0  
-print s88get(11) +print "RUN!" 
-print s88get(12) +sleep 1000 
-print s88get(13) +wend 
-print s88get(14) + 
-print s88get(15) +print "S88 Adr.1 Detected" 
-print s88get(16)+spd 3,0 
 +sleep 2000 
 + 
 +print "REV" 
 +dir 3,2 
 +spd 3,200 
 +sleep 12000 
 +spd 3,0 
 + 
 +fnc 3,0,0 
 +fnc 3,1,0 
 + 
 +print "end."
 end end
 </code> </code>
行 279: 行 369:
 NEXT i NEXT i
 </code> </code>
 +
 +
 +
 +===== 活用例 =====
 +
 +皆様のDSbasicの活用例、サンプル、解説などお待ちしております。
 +
 +  * [[http://powerele.sblo.jp/article/185725380.html|DSbasicでポイントを使った自動運転をしてみた]] (DesktopStation公式ブログ)
 +  * [[https://tsujiru.hatenablog.com/entry/2019/04/30/195231|DSbasic 入門してみる(1)]],[[https://tsujiru.hatenablog.com/entry/2019/04/30/211900|(2)]],[[https://tsujiru.hatenablog.com/entry/2019/05/01/195229|(3)]],[[https://tsujiru.hatenablog.com/entry/2019/05/01/195229|(4)]],[[https://tsujiru.hatenablog.com/entry/2019/05/02/123319|(5)]],[[https://tsujiru.hatenablog.com/entry/2019/05/02/192817|(6)]],[[https://tsujiru.hatenablog.com/entry/2019/05/03/193437|(7)]] (つじるの忘れんぼ鉄道)
 +  * [[http://powerele.sblo.jp/article/185561119.html|DSbasicで運転支援機能]]  (DesktopStation公式ブログ)
 +  * [[http://powerele.sblo.jp/article/185548716.html|DSair2で自動運転をしてみる]]   (DesktopStation公式ブログ)
 +  * [[https://desktopstation.net/bb/showthread.php?tid=126|DSbasic (DSair用BASIC) 相談室]] デジタル鉄道模型フォーラム
  
  
行 284: 行 386:
 ===== Special Thanks ===== ===== Special Thanks =====
  
-DSbasic is powered by wwwbasic and Ace text editor.+DSbasic is powered by [[https://github.com/google/wwwbasic|wwwbasic]] and Ace text editor.
dsair2_basic.1550314952.txt.gz · 最終更新: 2019/02/16 20:02 by yaasan

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki