フェズパンダ2読書iButton

こんにちは

間違ったトピックに入れてしまったことをおizeびしますが、これは適切であり、他の人にとって十分なカルマがないように思われます。

ずっと前に、私は自分でFez Panda 2を購入しました( dfrobotで注文しました

役職

モデル

価格

2Aデュアルモーターコントローラー

DRI0002

17.00ドル

FEZ Panda II- .NET Micro Frameworkコントローラー

DFR0142

39.90ドル

Bluetoothの蜂

TEL0023

26.00ドル

Arduino(V5)のIO拡張シールド

DFR0088

18.00ドル

HKBRAM-保険なし(重量235.00 g):

7.00ドル

合計:

107.90ドル



甘やかされ、放棄されました。 このデバイスは昨夜私の目を引きました、そしてその隣はインターホンからの「タブレット」への鍵です。 そこで、そこからデータを読み取ろうとすることにしました。 1-Wireインターフェースで動作します(パンダの説明によれば、「任意のIOで利用可能」)



私は彼の作品をペイントしません。興味のある人はここで読むことができます

動作させるには、ここでそのような図をはんだ付け/ねじる必要があります:



プルアップ抵抗







証拠



アプリケーションコードは次のようになります。

using System;

using System.Threading;



using Microsoft.SPOT;

using Microsoft.SPOT.Hardware;



using GHIElectronics.NETMF.FEZ;

using GHIElectronics.NETMF.Hardware;



namespace iButton

{

public class Program

{

static OneWire ow = new OneWire((Cpu.Pin)FEZ_Pin.Digital.Di4);

static OutputPort led = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, false );



public static void Main()

{

bool ledState = false ;



while ( true )

{

byte [] readall = new byte [8];



if (ow.Search_GetNextDevice(readall))

{

string hex = ByteArrayToString(readall);

Debug.Print( "========================" );

if (readall[0] != 0x01)

{

Debug.Print( "Device is not a DS1990A family device." );

}

Debug.Print(hex);



for ( int i = 0; i < 6; i++)

{

Thread.Sleep(200);

ledState = !ledState;

led.Write(ledState);

}

}

}

}



public static string ByteArrayToString( byte [] ba)

{

string hex = string .Empty;

for ( int i = ba.Length - 1; i >= 0; i--)

{

hex += " " + ByteToHex(ba[i]);

}



return hex;

}



public static string ByteToHex( byte b)

{

const string hex = "0123456789ABCDEF" ;

int lowNibble = b & 0x0F;

int highNibble = (b & 0x0F0) >> 4;

string s = new string ( new char [] { hex[highNibble], hex[lowNibble] });



return s;

}

}

}



* This source code was highlighted with Source Code Highlighter .









using System;

using System.Threading;



using Microsoft.SPOT;

using Microsoft.SPOT.Hardware;



using GHIElectronics.NETMF.FEZ;

using GHIElectronics.NETMF.Hardware;



namespace iButton

{

public class Program

{

static OneWire ow = new OneWire((Cpu.Pin)FEZ_Pin.Digital.Di4);

static OutputPort led = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, false );



public static void Main()

{

bool ledState = false ;



while ( true )

{

byte [] readall = new byte [8];



if (ow.Search_GetNextDevice(readall))

{

string hex = ByteArrayToString(readall);

Debug.Print( "========================" );

if (readall[0] != 0x01)

{

Debug.Print( "Device is not a DS1990A family device." );

}

Debug.Print(hex);



for ( int i = 0; i < 6; i++)

{

Thread.Sleep(200);

ledState = !ledState;

led.Write(ledState);

}

}

}

}



public static string ByteArrayToString( byte [] ba)

{

string hex = string .Empty;

for ( int i = ba.Length - 1; i >= 0; i--)

{

hex += " " + ByteToHex(ba[i]);

}



return hex;

}



public static string ByteToHex( byte b)

{

const string hex = "0123456789ABCDEF" ;

int lowNibble = b & 0x0F;

int highNibble = (b & 0x0F0) >> 4;

string s = new string ( new char [] { hex[highNibble], hex[lowNibble] });



return s;

}

}

}



* This source code was highlighted with Source Code Highlighter .









using System;

using System.Threading;



using Microsoft.SPOT;

using Microsoft.SPOT.Hardware;



using GHIElectronics.NETMF.FEZ;

using GHIElectronics.NETMF.Hardware;



namespace iButton

{

public class Program

{

static OneWire ow = new OneWire((Cpu.Pin)FEZ_Pin.Digital.Di4);

static OutputPort led = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, false );



public static void Main()

{

bool ledState = false ;



while ( true )

{

byte [] readall = new byte [8];



if (ow.Search_GetNextDevice(readall))

{

string hex = ByteArrayToString(readall);

Debug.Print( "========================" );

if (readall[0] != 0x01)

{

Debug.Print( "Device is not a DS1990A family device." );

}

Debug.Print(hex);



for ( int i = 0; i < 6; i++)

{

Thread.Sleep(200);

ledState = !ledState;

led.Write(ledState);

}

}

}

}



public static string ByteArrayToString( byte [] ba)

{

string hex = string .Empty;

for ( int i = ba.Length - 1; i >= 0; i--)

{

hex += " " + ByteToHex(ba[i]);

}



return hex;

}



public static string ByteToHex( byte b)

{

const string hex = "0123456789ABCDEF" ;

int lowNibble = b & 0x0F;

int highNibble = (b & 0x0F0) >> 4;

string s = new string ( new char [] { hex[highNibble], hex[lowNibble] });



return s;

}

}

}



* This source code was highlighted with Source Code Highlighter .














近い将来に空のキーを購入する場合は、利用可能なデータを使用してそれをプログラムしようとします。



All Articles