1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

STM32F4DISCOVERY + .NET Micro FrameworkでLチカ

Posted at

はじめに

こちらの手順で.NET MFを書き込んだSTM32F4DISCOVERYを使って、LEDを点滅させてみます。
Windows 8 64Bit + Visual Studio Express 2012 for Windows Desktop + .NET Micro Framework V4.3 RTMを使います。

手順

Visual Studioを起動して、プロジェクトを作成します。

  1. ファイル > 新しいプロジェクト を選択
  2. Visual C# > Micro Framework > Console Application を選択
  3. プロジェクト > 参照の追加 を選択
    • Microsoft.SPOT.Hardware を選択してOK
  4. プロジェクト > 既存項目の追加 を選択
    • C:\MicroframeWorkPK_4_3\DeviceCode\Targets\Native\STM32F4\ManagedCode\Hardware を開く
    • "HardwareProvider.cs" "CPU.cs" を選択して OK
  5. プロジェクト > プロパティ を選択
  6. .NET Micro Framework タブを選択、TransportにUSBを選択し、DeviceがCerb-Family_Gadgeteerとなったことを確認
  7. Program.csを開く
Program.cs
using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using Microsoft.SPOT.Hardware.STM32F4;

namespace STM32F_Test
{
    public class Program
    {
        public static void Main()
        {
            OutputPort led = new OutputPort(Pins.GPIO_PIN_A_1, false); 

            while (true)
            {
                led.Write(true);
                Thread.Sleep(250);
                led.Write(false);
                Thread.Sleep(250);
            }
        }
    }
}

実行

PA1(とGND)にLEDを接続します。
あとは、Visual Studioの開始ボタンを押すだけ。

デバッガも動きますので、一時停止などもできるようです。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?