using System.Threading;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware.NetduinoPlus;
namespace NetduinoPlusApplication1
{
public class Program
{
public static OutputPort LED;
public static void Main()
{
LED = new OutputPort(Pins.ONBOARD_LED, false);
int waittime = 100;
while (true)
{
sendText("SOS", waittime);
}
}
public static void sendText(string text, int sigtime)
{
for (int i = 0; i < text.Length; i++)
{
sendMorse(getMorse(text[i]), sigtime);
}
Thread.Sleep(sigtime * 7);
}
public static void sendMorse(string morse, int sigtime)
{
if (morse[0] != '0')
{
for (int i = 0; i < morse.Length; i++)
{
LED.Write(true);
Thread.Sleep((morse[i] == '1' ? (sigtime) : (sigtime * 3)));
LED.Write(false);
Thread.Sleep(sigtime);
}
}
Thread.Sleep(sigtime * 3);
}
public static string getMorse(char c)
{
switch (c)
{
case ('A'): return "12";
case ('B'): return "2111";
case ('C'): return "2121";
case ('D'): return "211";
case ('E'): return "1";
case ('F'): return "1121";
case ('G'): return "221";
case ('H'): return "1111";
case ('I'): return "11";
case ('J'): return "1222";
case ('K'): return "212";
case ('L'): return "1211";
case ('M'): return "22";
case ('N'): return "21";
case ('O'): return "222";
case ('P'): return "1221";
case ('Q'): return "2212";
case ('R'): return "121";
case ('S'): return "111";
case ('T'): return "2";
case ('U'): return "112";
case ('V'): return "1112";
case ('W'): return "122";
case ('X'): return "2112";
case ('Y'): return "2122";
case ('Z'): return "2211";
case ('1'): return "12222";
case ('2'): return "11222";
case ('3'): return "11122";
case ('4'): return "11112";
case ('5'): return "11111";
case ('6'): return "21111";
case ('7'): return "22111";
case ('8'): return "22211";
case ('9'): return "22221";
case ('0'): return "22222";
default: return "0";
}
}
}
}
/* *** */
とりあえずアルファベットと数字だけ
しかしまぁ最近回線速度が酷く遅い
測定サイトだと下り5上り1位出てるから
遅いって言うほど遅くもないんだけど
なぜかページが開けない
どうやらアップリンクが捨てられてる時が有るらしいんだが
ウイルス対策ソフト?
0 件のコメント:
コメントを投稿