本文整理汇总了C#中Microsoft.SPOT.Hardware.OutputPort类的典型用法代码示例。如果您正苦于以下问题:C# OutputPort类的具体用法?C# OutputPort怎么用?C# OutputPort使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OutputPort类属于Microsoft.SPOT.Hardware命名空间,在下文中一共展示了OutputPort类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: LEDStrip
public LEDStrip(Cpu.Pin clockPin, Cpu.Pin dataPin)
{
NumOfLEDs = 32;
_clock = new OutputPort(clockPin, false);
_data = new OutputPort(dataPin, false);
post_frame();
}
开发者ID:AndyCross,项目名称:netmfazurequeue,代码行数:7,代码来源:LEDStrip.cs
示例2: MatrixDisplay32x8
private readonly byte[] _shadowBuffers; // Will store the pixel data for each display
#endregion Fields
#region Constructors
public MatrixDisplay32x8( byte numDisplays,
Cpu.Pin clkPin,
Cpu.Pin dataPin,
bool buildShadow )
{
_backBufferSize = BACKBUFFER_SIZE;
DisplayCount = numDisplays;
// set data & clock pin modes
_clkPin = new OutputPort( clkPin, true );
_dataPin = new OutputPort( dataPin, true );
// allocate RAM buffer for display bits
// 32 columns * 8 rows / 8 bits = 32 bytes
int sz = DisplayCount * _backBufferSize;
_displayBuffers = new byte[sz];
if( buildShadow )
{
// allocate RAM buffer for display bits
_shadowBuffers = new byte[sz];
}
// allocate a buffer for pin assignments
_displayPins = new OutputPort[numDisplays];
}
开发者ID:HakanL,项目名称:NetduinoStuff,代码行数:32,代码来源:MatrixDisplay32x8.cs
示例3: ShiftRegister74HC595
private OutputPort stcpPort; // Storage Register Clock pin
#endregion Fields
#region Constructors
/// <summary>
/// Constructor
/// </summary>
/// <param name="ds">Pin Serial Data</param>
/// <param name="shcp">Pin Shift Register Clock</param>
/// <param name="stcp">Pin Storage Register Clock</param>
/// <param name="mr">Pin Master Reset</param>
/// <param name="oe">Pin Output Enable</param>
/// <param name="bitOrder">Bit order during transferring</param>
public ShiftRegister74HC595(Cpu.Pin ds, Cpu.Pin shcp, Cpu.Pin stcp, Cpu.Pin mr, Cpu.Pin oe, BitOrder bitOrder)
{
// Serial Data (DS) pin is necessary
if (ds == Cpu.Pin.GPIO_NONE)
throw new ArgumentException("Serial Data (DS) pin is necessary");
this.dsPort = new OutputPort(ds, false);
// Shift Register Clock (SHCP) pin is necessary
if (shcp == Cpu.Pin.GPIO_NONE)
throw new ArgumentException("Shift Register Clock (SHCP) pin is necessary");
this.shcpPort = new OutputPort(shcp, false);
// you can save 1 pin connecting STCP and SHCP together
if (stcp != Cpu.Pin.GPIO_NONE)
this.stcpPort = new OutputPort(stcp, false);
// you can save 1 pin connecting MR pin to Vcc (no reset)
if (mr != Cpu.Pin.GPIO_NONE)
this.mrPort = new OutputPort(mr, true);
// you can save 1 pin connecting OE pin to GND (shift register output pins are always enabled)
if (oe != Cpu.Pin.GPIO_NONE)
this.oePort = new OutputPort(oe, false);
this.bitOrder = bitOrder;
}
开发者ID:ppatierno,项目名称:uplibrary,代码行数:41,代码来源:ShiftRegister74HC595.cs
示例4: MidiDriver
public MidiDriver(Cpu.Pin resetPin, string serialPortName = Serial.COM2)
{
_resetPinPort = new OutputPort(resetPin, false);
_serialPort = new SerialPort(serialPortName, 31250, Parity.None, 8, StopBits.One);
_serialPort.Open();
}
开发者ID:cjdaly,项目名称:napkin,代码行数:7,代码来源:MidiDriver.cs
示例5: OLED_sh1106
public OLED_sh1106(Cpu.Pin csPin, OutputPort dcPin, OutputPort rsPin)
{
displayStr = "";
spiDevice = new SPI(new SPI.Configuration(csPin, false, 0, 0, false, true, 10000, SPI.SPI_module.SPI1));
dataCommandPin = dcPin;
resetOutputPort = rsPin;
}
开发者ID:wjmwjm119,项目名称:NetduinoOLED,代码行数:7,代码来源:OLED_sh1106.cs
示例6: Main
public static void Main()
{
// Setup GoBus ports
led1 = new NetduinoGo.RgbLed(GoSockets.Socket8);
led2 = new NetduinoGo.RgbLed(GoSockets.Socket7);
led3 = new NetduinoGo.RgbLed(GoSockets.Socket6);
button1 = new NetduinoGo.Button(GoSockets.Socket1);
button2 = new NetduinoGo.Button(GoSockets.Socket3);
InterruptPort settingButton = new InterruptPort(Pins.Button, false, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeLow);
settingButton.OnInterrupt += new NativeEventHandler(settingButton_OnInterrupt);
OutputPort powerlight = new OutputPort(Pins.PowerLed, false);
#if !mute
buzzer = new NetduinoGo.PiezoBuzzer();
#endif
// Set Scale
SetScale();
// Register Buttons
button1.ButtonPressed += new NetduinoGo.Button.ButtonEventHandler(button1_ButtonPressed);
button2.ButtonPressed += new NetduinoGo.Button.ButtonEventHandler(button2_ButtonPressed);
led2.SetColor(0, 0, 255);
// Main thread sleep time
Thread.Sleep(Timeout.Infinite);
}
开发者ID:BlackLamb,项目名称:GameTimer,代码行数:26,代码来源:Program.cs
示例7: Main
public static void Main()
{
OutputPort led = new OutputPort(Pins.ONBOARD_LED, false);
MorseCode mc = new MorseCode(led, 150);
mc.parseMorse("Hello World");
}
开发者ID:okeefm,项目名称:HelloMorse,代码行数:7,代码来源:HelloMorse.cs
示例8: Config
static Config()
{
Latch = new OutputPort(Pins.GPIO_PIN_D9, false);
Device = new SPI.Configuration(
ChipSelect_Port: Pins.GPIO_NONE, // SS-pin = slave select, not used
ChipSelect_ActiveState: false, // SS-pin active state
ChipSelect_SetupTime: 0, // The setup time for the SS port
ChipSelect_HoldTime: 0, // The hold time for the SS port
Clock_IdleState: true, // The idle state of the clock
Clock_Edge: true, // The sampling clock edge
Clock_RateKHz: 30000,
// The SPI clock rate in KHz ==> enough to start with, let's see how high we can take this later on
SPI_mod: SPI.SPI_module.SPI1
// The used SPI bus (refers to a MOSI MISO and SCLK pinset) => default pins, also the ones used on the pwm shield
// specifically: sin = 11, (netduino send, tlc in) and sclck = 13
);
// better to pass in the pins, and let the ports and pwms be managed insode the device
Blank = new PWM(Pins.GPIO_PIN_D10);
Gsclk = new PWM(Pins.GPIO_PIN_D6);
LayerPorts=new[]
{
new OutputPort(Pins.GPIO_PIN_D5, false),
new OutputPort(Pins.GPIO_PIN_D4, false),
new OutputPort(Pins.GPIO_PIN_D3, false),
new OutputPort(Pins.GPIO_PIN_D2, false),
new OutputPort(Pins.GPIO_PIN_D7, false),
new OutputPort(Pins.GPIO_PIN_D8, false)
};
SideLength = 6;
TlcChannelCount = 112;
}
开发者ID:Kuirak,项目名称:LEDCube,代码行数:33,代码来源:Config.cs
示例9: SiliconLabsSI7005
public SiliconLabsSI7005(byte deviceId = DeviceIdDefault, int clockRateKHz = ClockRateKHzDefault, int transactionTimeoutmSec = TransactionTimeoutmSecDefault)
{
this.deviceId = deviceId;
this.clockRateKHz = clockRateKHz;
this.transactionTimeoutmSec = transactionTimeoutmSec;
using (OutputPort i2cPort = new OutputPort(Pins.GPIO_PIN_SDA, true))
{
i2cPort.Write(false);
Thread.Sleep(250);
}
using (I2CDevice device = new I2CDevice(new I2CDevice.Configuration(deviceId, clockRateKHz)))
{
byte[] writeBuffer = { RegisterIdDeviceId };
byte[] readBuffer = new byte[1];
// The first request always fails
I2CDevice.I2CTransaction[] action = new I2CDevice.I2CTransaction[]
{
I2CDevice.CreateWriteTransaction(writeBuffer),
I2CDevice.CreateReadTransaction(readBuffer)
};
if( device.Execute(action, transactionTimeoutmSec) == 0 )
{
// throw new ApplicationException("Unable to send get device id command");
}
}
}
开发者ID:CanterburyRegionalCouncil,项目名称:AirQualityMonitoringDevice,代码行数:30,代码来源:SiliconLabsSI7005.cs
示例10: Main
static void Main()
{
var lowPort = new OutputPort(Parameters.LowPin, false);
var highPort = new OutputPort(Parameters.HighPin, true);
var voltageSensor = new AnalogSensor
{
InputPin = Parameters.AnalogPin,
MinValue = 0.0,
MaxValue = 3.3
};
var webServer = new HttpServer
{
RelayDomain = Parameters.RelayDomain,
RelaySecretKey = Parameters.RelaySecretKey,
RequestRouting =
{
{
"GET /voltage/actual",
new MeasuredVariable
{
FromSensor = voltageSensor.HandleGet
}.HandleRequest
}
}
};
webServer.Run();
}
开发者ID:jchidley,项目名称:GSIOT-NP2,代码行数:30,代码来源:Program.cs
示例11: Main
public static void Main()
{
var thdLed = new Thread(HandleLed);
thdLed.Start();
var digitalSensor = new DigitalSensor { InputPin = Pins.GPIO_PIN_D12 };
var analogSensor = new AnalogSensor { InputPin = Pins.GPIO_PIN_A1, MinValue = 0.0, MaxValue = 3.3 };
var lowPort = new OutputPort(Pins.GPIO_PIN_A0, false);
var highPort = new OutputPort(Pins.GPIO_PIN_A2, true);
var ledActuator = new DigitalActuator { OutputPin = Pins.GPIO_PIN_D13 };
//need to create HTTP PUTs!
var webServer = new HttpServer
{
RelayDomain = "gsiot-bcjp-yj88",
RelaySecretKey = "HDMvyM11hAu6H6cxIaT50dL9ALWc81MYB8H/UFhV",
RequestRouting =
{
{ "GET /hello*", HandleHello }, //This accepts a lot of URLs
{ "GET /on", HandleOn },
{ "GET /off", HandleOff },
{ "POST /on", HandlePostOn },
{ "POST /off", HandlePostOff },
{ "GET /d12", new MeasuredVariable{ FromSensor=digitalSensor.HandleGet}.HandleRequest},
{ "GET /a1", new MeasuredVariable{ FromSensor=analogSensor.HandleGet}.HandleRequest},
{ "PUT /d13", new ManipulatedVariable{ FromHttpRequest=CSharpRepresentation.TryDeserializeBool,ToActuator=ledActuator.HandlePut}.HandleRequest},
}
};
webServer.Run();
}
开发者ID:refap3,项目名称:refAP3repo,代码行数:31,代码来源:HelloWeb.cs
示例12: Main
public static void Main()
{
OutputPort led = new OutputPort(Pins.ONBOARD_LED, false);
led.Write(true);
VoltageDivider voltageReader = new VoltageDivider(Pins.GPIO_PIN_A1, 470000, 4700);
Acs712 currentReader = new Acs712(Pins.GPIO_PIN_A2, Acs712.Range.ThirtyAmps);
EmonCmsProxy.Start();
MpptOptimizer.Start();
led.Write(false);
led.Dispose();
GC.WaitForPendingFinalizers();
//Random r = new Random((int) DateTime.Now.Ticks);
while (true)
{
double current = //r.NextDouble() / double.MaxValue * 10;
currentReader.Read();
double voltage = //r.NextDouble() / double.MaxValue * 3;
voltageReader.Read();
EmonCmsProxy.Push(current, voltage);
MpptOptimizer.Push(current, voltage);
Thread.Sleep(50);
}
}
开发者ID:dedalebeda,项目名称:emoncms-power-reader,代码行数:29,代码来源:Program.cs
示例13: Stepper
public Stepper(Cpu.Pin pinCoil1A, Cpu.Pin pinCoil1B, Cpu.Pin pinCoil2A, Cpu.Pin pinCoil2B, uint stepsPerRevolution, string name)
: base(name, "stepper")
{
// remember the steps per revolution
this.StepsPerRevolution = stepsPerRevolution;
// reset the step-counter
this.currentStep = 0;
// determine correct pins for the coils; turn off all motor pins
this.portCoil1A = new OutputPort(pinCoil1A, false);
Util.Delay(500);
this.portCoil1B = new OutputPort(pinCoil1B, false);
Util.Delay(500);
this.portCoil2A = new OutputPort(pinCoil2A, false);
Util.Delay(500);
this.portCoil2B = new OutputPort(pinCoil2B, false);
// set the maximum speed
SetSpeed(120);
}
开发者ID:StephanieMak,项目名称:IoT-Maker-Den-NETMF,代码行数:25,代码来源:Stepper.cs
示例14: Connect
public void Connect(Cpu.Pin pinTrig, Cpu.Pin pinEcho)
{
_portOut = new OutputPort(pinTrig, false);
_interIn = new InterruptPort(pinEcho, false, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeLow);
_interIn.OnInterrupt += new NativeEventHandler(interIn_OnInterrupt);
Reset();
}
开发者ID:WesDaniels,项目名称:ColdBeer,代码行数:7,代码来源:Ping.cs
示例15: XBeeDevice
public XBeeDevice(SerialPort port, Cpu.Pin resetPin, Cpu.Pin sleepPin)
{
_resetPort = new OutputPort(resetPin, true);
_sleepPort = new OutputPort(sleepPin, false);
_serialPort = port;
new Thread(ReadThread).Start();
}
开发者ID:VerdantAutomation,项目名称:VerdantVines,代码行数:7,代码来源:XBeeDevice.cs
示例16: HandleClients
public HandleClients(Socket clientSocket, OutputPort led)
{
this.clientSocket = clientSocket;
this.led = led;
clientIP = clientSocket.RemoteEndPoint as IPEndPoint;
clientEndPoint = clientSocket.RemoteEndPoint;
}
开发者ID:K0HAX,项目名称:NetduinoSockets,代码行数:7,代码来源:HandleClients.cs
示例17: Main
public static void Main()
{
// Create three colors, all LEDs off
RGB first = new RGB(0, 0, 0);
RGB second = new RGB(0, 0, 0);
RGB third = new RGB(0, 0, 0);
// Put them into an array
RGB[] colors = { first, second, third };
// Use D6 for CIN and D7 for DIN (Grove Base Shield v1.2 header #6)
OutputPort cin = new OutputPort(Pins.GPIO_PIN_D6, false);
OutputPort din = new OutputPort(Pins.GPIO_PIN_D7, false);
// Create our chainable RGB led object using the ports from above
ChainableRGBLed leds = new ChainableRGBLed(cin, din);
// Loop forever
while (true)
{
// Set the colors
leds.setColors(colors);
// Randomize each color
randomize(first);
randomize(second);
randomize(third);
}
}
开发者ID:timmattison,项目名称:timmattison-netduino-drivers,代码行数:29,代码来源:Program.cs
示例18: Motor
public Motor(MotorShield shield, OutputPort port, byte bitmaskUp, byte bitmaskDown)
{
_shield = shield;
_bitmaskUp = bitmaskUp;
_bitmaskDown = bitmaskDown;
_port = port;
}
开发者ID:ricflams,项目名称:Goke.ChickenHouse,代码行数:7,代码来源:Motor.cs
示例19: Main
public static void Main()
{
//NetworkInterface.GetAllNetworkInterfaces()[0].EnableDhcp();
NetworkInterface.GetAllNetworkInterfaces()[0].EnableStaticIP("192.168.0.16","255.255.255.0","192.168.0.1");
// NetworkInterface.GetAllNetworkInterfaces()[0].RenewDhcpLease();
// var ipAddress = NetworkInterface.GetAllNetworkInterfaces()[0].IPAddress;
Thread.Sleep(1000);
Debug.Print("Dirs: ");
Debug.Print(Directory.GetCurrentDirectory());
Directory.SetCurrentDirectory(@"\SD");
string[] dirs = Directory.GetDirectories(@"\SD");
var webServer = new Server.WebServer {WebFolder = WebFolder, Port = 80};
webServer.Start();
var led = new OutputPort(Pins.ONBOARD_LED, false);
while (true)
{
// Blink LED to show we're still responsive
led.Write(!led.Read());
Thread.Sleep(2000);
}
}
开发者ID:adrianrussell,项目名称:MicroFrameworkWebServer,代码行数:27,代码来源:Program.cs
示例20: ShiftRegisterWriter
//private OutputPort _commitPin;
public ShiftRegisterWriter(Cpu.Pin clock, Cpu.Pin reset, Cpu.Pin data, Cpu.Pin commit)
{
_clockPin = new OutputPort(clock, false);
_dataPin = new OutputPort(data, false);
_resetPin = new OutputPort(reset, false);
_commitPin = new OutputPort(commit, false);
}
开发者ID:John-Leitch,项目名称:fpga-md5-cracker,代码行数:8,代码来源:ShiftRegisterWriter.cs
注:本文中的Microsoft.SPOT.Hardware.OutputPort类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论