当前位置: 首页>>代码示例>>C#>>正文


C# Gadgeteer类代码示例

本文整理汇总了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();
 }
开发者ID:user-mfp,项目名称:IMI,代码行数:7,代码来源:Program.cs

示例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();
    }
开发者ID:joram,项目名称:Gadgeteer,代码行数:40,代码来源:LedStripLPD8806.cs

示例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();
 }
开发者ID:jfcaiceo,项目名称:HomeSecurityGadgeteer,代码行数:7,代码来源:Wifi.cs

示例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();
 }
开发者ID:Rhesos,项目名称:SDKGadgeteer,代码行数:7,代码来源:SDCardState.cs

示例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;
        }
开发者ID:pranay22,项目名称:tu-darmstadt-TK3,代码行数:15,代码来源:ModeSelection.cs

示例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);
        }
开发者ID:scout119,项目名称:ScratchDotNet,代码行数:10,代码来源:UsbSerialCommunicationChannel.cs

示例7: _getReading_Tick

 void _getReading_Tick(GT.Timer timer)
 {
     if (!Scheduler.Instance().gasContinue())
         return;
     gs.SetHeatingElement(true);
     _preheat.Start();
 }
开发者ID:jfcaiceo,项目名称:HomeSecurityGadgeteer,代码行数:7,代码来源:Gas.cs

示例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;
 }
开发者ID:jfcaiceo,项目名称:HomeSecurityGadgeteer,代码行数:7,代码来源:CameraClass.cs

示例9: hideMessage_Tick

        void hideMessage_Tick(GT.Timer timer)
        {
            timer.Stop();

            label.Visibility = Visibility.Collapsed;
            imageDisplay.Visibility = Visibility.Visible;
        }
开发者ID:BigRunningBack,项目名称:gadgeteer_book,代码行数:7,代码来源:Program.cs

示例10: timer_Tick

 void timer_Tick(GT.Timer timer)
 {
     led_Strip.TurnLEDOff(_ledNumberToModify);
     if (_ledNumberToModify == LastLed) _ledNumberToModify = FirstLed;
     else _ledNumberToModify++;
     led_Strip.TurnLEDOn(_ledNumberToModify);
 }
开发者ID:steenhulthin,项目名称:HelloLedStripModule,代码行数:7,代码来源:Program.cs

示例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;
            }
        }
开发者ID:TheLurps,项目名称:Robot_arm_lite,代码行数:35,代码来源:Program.cs

示例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);
            }
        }
开发者ID:adriannieto,项目名称:GadgeteerMisileLauncher,代码行数:29,代码来源:Program.cs

示例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);
 }
开发者ID:ZingPow,项目名称:Breakout_Boards,代码行数:7,代码来源:Program.cs

示例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();
 }
开发者ID:SimPrints,项目名称:Office-Train,代码行数:7,代码来源:Program.cs

示例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;
 }
开发者ID:jfcaiceo,项目名称:HomeSecurityGadgeteer,代码行数:9,代码来源:Devices.cs


注:本文中的Gadgeteer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。