本文整理汇总了C#中Gadgeteer类的典型用法代码示例。如果您正苦于以下问题:C# Gadgeteer类的具体用法?C# Gadgeteer怎么用?C# Gadgeteer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Gadgeteer类属于命名空间,在下文中一共展示了Gadgeteer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: timer_Tick
void timer_Tick(Gadgeteer.Timer timer)
{
//You only need to enter pairing mode once with a device. After you pair for the first time, it will
//automatically connect in the future.
if (!bluetooth.IsConnected)
bluetooth.ClientMode.EnterPairingMode();
}
示例2: LedStripLPD8806
/// <summary>
/// c'tor
/// </summary>
/// <param name="socket">the Gadgeteer socket that the strip is on</param>
/// <param name="numLeds">the number of LEDs in the strip</param>
public LedStripLPD8806(GT.Socket socket, int numLeds)
{
var spiConfig = new SPI.Configuration(Cpu.Pin.GPIO_NONE,
false, // chip select active state
0, // chip select setup time
0, // chip select hold time
false, // clock idle state
true, // clock edge (true = rising)
2000, // 2mhz
SPI.SPI_module.SPI1
);
// the protocol seems to be that we need to write 1 + (1 per 64 LEDs) bytes
// at the end of each update (I've only tested this on a 32-LED strip)
int latchBytes = ((numLeds + 63) / 64) * 3;
mLedByteCount = numLeds * 3;
mData = new byte[mLedByteCount + latchBytes];
mNumLeds = numLeds;
// mLedStrip = new SPI(socket, spiConfig, SPI.Sharing.Exclusive, null);
mLedStrip = new SPI(spiConfig);
// start with all the LEDs off
for (int i = 0; i < mLedByteCount; i++)
{
mData[i] = MASK;
}
// give the strip an inital poke of the latch bytes (no idea
// why this is needed)
mLedStrip.Write(new byte[latchBytes]);
// push the initial values (all off) to the strip
SendUpdate();
}
示例3: Wifi
public Wifi(Gadgeteer.Modules.GHIElectronics.WiFi_RS21 wifi_RS21)
{
this.wifi_RS21 = wifi_RS21;
t = new GT.Timer(3000);
t.Tick += new GT.Timer.TickEventHandler(start);
t.Start();
}
示例4: JoystickPressed
public override void JoystickPressed(Gadgeteer.Modules.GHIElectronics.Joystick sender, Gadgeteer.Modules.GHIElectronics.Joystick.JoystickState state)
{
_Data = new ExampleData();
_Data.LastDate = DateTime.Now;
SaveData();
PrintLastDate();
}
示例5: ModeSelection
/// <summary>
/// Constructor, initalizes all the needed elements
/// </summary>
/// <param name="display"></param>
/// <param name="button"></param>
/// <param name="joystick"></param>
public ModeSelection(Gadgeteer.Modules.Module.DisplayModule display, Gadgeteer.Modules.GHIElectronics.Joystick joystick, EventHandler handler)
{
this.display = display;
this.joystick = joystick;
this.pos_joystick = new Gadgeteer.Modules.GHIElectronics.Joystick.Position();
display.SimpleGraphics.Clear();
inputFinished = handler;
}
示例6: Port_DataReceived
void Port_DataReceived(Gadgeteer.SocketInterfaces.Serial sender)
{
if (this.DataReceived == null)
return;
var buffer = new byte[sender.BytesToRead];
sender.Read(buffer, 0, buffer.Length);
this.DataReceived(this, buffer);
}
示例7: _getReading_Tick
void _getReading_Tick(GT.Timer timer)
{
if (!Scheduler.Instance().gasContinue())
return;
gs.SetHeatingElement(true);
_preheat.Start();
}
示例8: camera_PictureCaptured
void camera_PictureCaptured(Camera sender, GT.Picture picture)
{
wifi.SendPictureData(picture.PictureData, PhotoType.Central.ToString());
Debug.Print("foto");
sendingPicture = false;
Scheduler.Instance().Working = false;
}
示例9: hideMessage_Tick
void hideMessage_Tick(GT.Timer timer)
{
timer.Stop();
label.Visibility = Visibility.Collapsed;
imageDisplay.Visibility = Visibility.Visible;
}
示例10: timer_Tick
void timer_Tick(GT.Timer timer)
{
led_Strip.TurnLEDOff(_ledNumberToModify);
if (_ledNumberToModify == LastLed) _ledNumberToModify = FirstLed;
else _ledNumberToModify++;
led_Strip.TurnLEDOn(_ledNumberToModify);
}
示例11: DataReceived
void DataReceived(GT.Interfaces.Serial sender, System.IO.Ports.SerialData daten)
{
int BytesToRead = usbSerial.SerialLine.BytesToRead;
byte[] buffer = new byte[BytesToRead];
usbSerial.SerialLine.Read(buffer, 0, BytesToRead);
Debug.Print("Data received: " + BytesToRead + " Bytes" );
GT.Interfaces.PWMOutput ServoA = extender1.SetupPWMOutput(GT.Socket.Pin.Seven);
GT.Interfaces.PWMOutput ServoB = extender1.SetupPWMOutput(GT.Socket.Pin.Eight);
GT.Interfaces.PWMOutput ServoC = extender1.SetupPWMOutput(GT.Socket.Pin.Nine);
GT.Interfaces.PWMOutput ServoD = extender2.SetupPWMOutput(GT.Socket.Pin.Nine);
String bufferString = new String(UTF8Encoding.UTF8.GetChars(buffer));
Debug.Print("DATA: " + bufferString);
String servo = bufferString.Substring(0, 1);
UInt32 position = UInt32.Parse(bufferString.Substring(1, bufferString.Length - 1));
switch (servo)
{
case "g":
setServo(ServoA, position);
break;
case "1":
setServo(ServoB, position);
break;
case "2":
setServo(ServoC, position);
break;
case "r":
setServo(ServoD, position);
break;
}
}
示例12: joystickTimer_Tick
private void joystickTimer_Tick(GT.Timer timer)
{
const double X_DEADZONE = 0.25;
const double Y_DEADZONE = 0.25;
// If Misilelauncher is initializated, handle joystick position
if (launcherPod != null){
joystickPosition = joystick.GetPosition();
if (joystickPosition.X > X_DEADZONE)
{
launcherPod.MisileDO(MisileLauncher.MisileCommand.RIGHT);
}
else if (joystickPosition.X < -X_DEADZONE)
{
launcherPod.MisileDO(MisileLauncher.MisileCommand.LEFT);
}
if (joystickPosition.Y > Y_DEADZONE)
{
launcherPod.MisileDO(MisileLauncher.MisileCommand.UP);
}
else if (joystickPosition.Y < -Y_DEADZONE)
{
launcherPod.MisileDO(MisileLauncher.MisileCommand.DOWN);
}
launcherPod.MisileDO(MisileLauncher.MisileCommand.STOP);
}
}
示例13: _timer_Tick
private void _timer_Tick(GT.Timer timer)
{
Debug.Print("thermocouple temperature " + max31855Thermocouple.TemperatureCelsius());
////Debug.Print("calculated temperature " + max31855Thermocouple.correctedCelsius().ToString());
Debug.Print("junction temperature " + max31855Thermocouple.InternalCelsius());
Debug.Print("Fault " + max31855Thermocouple.Fault);
}
示例14: MainTimerCallback
private void MainTimerCallback(GT.Timer timer)
{
Debug.Print("Event: time to request server for orders");
var request = HttpHelper.CreateHttpGetRequest(STATUS_URL);
request.ResponseReceived += ServerResponseCallback;
request.SendRequest();
}
示例15: start
void start(GT.Timer timer)
{
Debug.Print("timer start");
t.Stop();
button.ButtonPressed += button_ButtonPressed;
blueT.DeviceInquired += blueT_DeviceInquired;
blueT.DataReceived += blueT_DataReceived;
blueT.BluetoothStateChanged += blueT_BluetoothStateChanged;
}