dsair2_basic
差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン前のリビジョン次のリビジョン | 前のリビジョン次のリビジョン両方とも次のリビジョン | ||
dsair2_basic [2019/02/16 19:53] – [文字を大きくする] yaasan | dsair2_basic [2019/03/03 11:07] – [Function] yaasan | ||
---|---|---|---|
行 1: | 行 1: | ||
====== DSair BASIC (DSbasic) ====== | ====== DSair BASIC (DSbasic) ====== | ||
- | [[DSair2_ukeng]] | + | Keywords: BASIC, Programming, |
+ | |||
+ | [[DSair2_ukeng]] | ||
DSbasic is a very easy programming solution on your smartphone! This function works in DSair2' | DSbasic is a very easy programming solution on your smartphone! This function works in DSair2' | ||
- | DSbasicは、スマートフォン(Android, | + | DSbasicは、スマートフォン(Android, |
{{http:// | {{http:// | ||
行 30: | 行 32: | ||
|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/ |
- | |FNX| LocAddr, FuncNo| FuncNo=0-28 | | + | |FNX| LocAddr, FuncNo| FuncNo=0-28, |
|MP3PLAY| FileName with Path | MP3PLAY " | |MP3PLAY| FileName with Path | MP3PLAY " | ||
|MP3STOP| - | MP3STOP | | |MP3STOP| - | MP3STOP | | ||
- | |GETACC| AccAddr(1-2044) | | | + | |GETACC| AccAddr(1-2044) |指定アドレスのポイント状態(0=div, |
+ | |GETACCW| AccAddr(1-2044) |指定アドレス以降16個分のポイント状態(0=div, | ||
|getslotaddr| SlotNo(0-3) | 4つのユーザー指定アドレススロットからアドレスを取得します。 | | |getslotaddr| SlotNo(0-3) | 4つのユーザー指定アドレススロットからアドレスを取得します。 | | ||
+ | |getslotspd| SlotNo(0-3) | 4つのユーザー指定アドレススロットから速度を取得します。 | | ||
+ | |getslotfnc| SlotNo(0-3), | ||
+ | |getslotfncw| SlotNo(0-3) | 4つのユーザー指定アドレススロットからファンクション状態を29bit分返します。 | | ||
|S88START| - | | | |S88START| - | | | ||
- | |S88GET| S88Sensor address(1-16) | Supported | + | |S88GET,GETS88| S88Sensor address(1-16) | S88センサーの値(0=OFF, |
+ | |GETS88W| S88Sensor address(1-16) | S88センサーの値を16bit分返します。 | ||
|DCPWM| PWMDuty(0-1203) | | | |DCPWM| PWMDuty(0-1203) | | | ||
+ | |DCDIR| Direction| FWD=1, REV=2 | | ||
The parameters of function mean as the followings.\\ | The parameters of function mean as the followings.\\ | ||
行 148: | 行 156: | ||
==== S88 decoder example ==== | ==== S88 decoder example ==== | ||
- | S88デコーダのセンサデータを取得するサンプルです。 | + | S88デコーダのセンサデータを取得し、Roco BR621(Addr.3)の往復運転を行うサンプルです。 |
+ | |||
+ | Detail: [[http:// | ||
< | < | ||
+ | screen(7) | ||
s88start | s88start | ||
- | testb = getacc(1) | + | |
- | test = s88get(1) | + | pwr 1 |
- | print s88get(2) | + | print "START S88 Control" |
- | print s88get(3) | + | |
- | print s88get(4) | + | dir 3,1 |
- | print s88get(5) | + | fnc 3,0,1 |
- | print s88get(6) | + | fnc 3,1,1 |
- | print s88get(7) | + | fnx 3,2 |
- | print s88get(8) | + | spd 3,200 |
- | print s88get(9) | + | |
- | print s88get(10) | + | while s88get(1)=0 |
- | print s88get(11) | + | print " |
- | 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 " | ||
+ | dir 3,2 | ||
+ | spd 3,200 | ||
+ | sleep 12000 | ||
+ | spd 3,0 | ||
+ | |||
+ | fnc 3,0,0 | ||
+ | fnc 3,1,0 | ||
+ | |||
+ | print " | ||
+ | end | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== Speed based Announce example ==== | ||
+ | |||
+ | This automatic announce program is triggered by slot 1 speed. | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | {{http:// | ||
+ | |||
+ | < | ||
+ | screen(7) | ||
+ | |||
+ | print " | ||
+ | print " | ||
+ | print " | ||
+ | |||
+ | state=0 | ||
+ | currentspd = getslotspd(0) | ||
+ | |||
+ | while 1 | ||
+ | |||
+ | sleep(1000) | ||
+ | if currentspd<> | ||
+ | print " | ||
+ | currentspd = getslotspd(0) | ||
+ | end if | ||
+ | |||
+ | if state=0 then | ||
+ | if getslotspd(0)>512 then | ||
+ | state = 1 | ||
+ | print "Next Station" | ||
+ | mp3play " | ||
+ | end if | ||
+ | end if | ||
+ | |||
+ | if state=1 then | ||
+ | if getslotspd(0)<100 then | ||
+ | state = 0 | ||
+ | print "Stop at Station" | ||
+ | mp3play " | ||
+ | end if | ||
+ | end if | ||
+ | wend | ||
end | end | ||
</ | </ |
dsair2_basic.txt · 最終更新: 2023/09/02 11:01 by yaasan