cerbuinoBeeを使ってみよう

LEDチカチカ



LEDを点滅させるプログラム
using System;
using System.Collections;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Presentation.Shapes;
using Microsoft.SPOT.Touch;

using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;

using GHI.OSHW.Hardware;        // 追加、参照設定にも追加
using GHI.Hardware.FEZCerb;     // 追加、参照設定にも追加
using Microsoft.SPOT.Hardware;

namespace beeLEDblink
{
    public partial class Program
    {
        GT.Timer tm = new GT.Timer(1000, GT.Timer.BehaviorType.RunContinuously);
        void ProgramStarted()
        {
            tm.Start();
            tm.Tick += new GT.Timer.TickEventHandler(TimeCounter);
            new Thread(proc).Start();
        }
        int timeCount=0;
        void TimeCounter(GT.Timer timer)
        {
            timeCount++;
        }
        void proc()
        {
            int i = 0;
            OutputPort LED1 = new OutputPort(Pin.PB1, false);
            while(true)
            {
                LED1.Write(true);
                Thread.Sleep(500);
                LED1.Write(false);
                Thread.Sleep(500);
                Debug.Print(":" + (i++));
            }
        }
    }
}
 1 
 2 
 3 
 4 
 5 
 6 
 7 
 8 
 9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
35 
36 
37 
38 
39 
40 
41 
42 
43 
44 
45 
46 
47 
48 
49