はじめに
先日,
ガンダムに対抗するわけではないのですが,
こんなふうに動きます
まずは写真のような一直線のレイアウトを動かしてみましょう。普通のNゲージでは電源は1ヵ所だけ供給しますが,
そして,
リスト1 左端まで進む
#! /usr/local/bin/php
<?php
$url = "http://192.168.0.100/";
file_get_contents($url."?00=C");
file_get_contents($url."?01=D");
file_get_contents($url."?02=D");
file_get_contents($url."?03=C");
?>
往復運転させるには,
リスト2 往復運転
#! /usr/local/bin/php
<?php
$url = "http://192.168.0.100/";
for (;;) {
file_get_contents($url."?00=C");
file_get_contents($url."?01=D");
file_get_contents($url."?02=D");
file_get_contents($url."?03=C");
sleep(30);
file_get_contents($url."?00=A");
file_get_contents($url."?01=A");
file_get_contents($url."?02=A");
file_get_contents($url."?03=A");
file_get_contents($url."?04=c");
file_get_contents($url."?03=d");
file_get_contents($url."?02=d");
file_get_contents($url."?01=c");
sleep(30);
file_get_contents($url."?04=A");
file_get_contents($url."?03=A");
file_get_contents($url."?02=A");
file_get_contents($url."?01=A");
}
?>
見ての通り,
LANから制御する仕掛け
Nゲージの動く仕組みは,
今回のシステムでは,
このようなシステムには,
コントローラはHTTPサーバになっており,http://
のリクエストを送ると,
表1 コマンド一覧
コマンド | 機能 |
---|---|
A | 停止 |
B | 走行1/ |
C | 走行1/ |
D | 走行1/ |
E | 走行1/ |
F | 走行100% |
b | 逆走行1/ |
c | 逆走行1/ |
d | 逆走行1/ |
e | 逆走行1/ |
f | 逆走行100% |
P | ポイント分岐 |
p | ポイント直進 |
S | 車両検出 |
では,