• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Gadgeteer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Gadgeteer的典型用法代码示例。如果您正苦于以下问题:C# Gadgeteer类的具体用法?C# Gadgeteer怎么用?C# Gadgeteer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Gadgeteer类属于命名空间,在下文中一共展示了Gadgeteer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: cardReader_Mounted

 private void cardReader_Mounted(SDCard sender, Gadgeteer.StorageDevice device)
 {
     if (sender.StorageDevice.Volume.IsFormatted)
     {
         if (sdCard.IsCardMounted)
         {
             Logger.WriteInfo("RPTR", "Media directory/file listing: ");
             FileListing(sdCard.StorageDevice.RootDirectory);
         }
     }
 }
开发者ID:marinehero,项目名称:microserver,代码行数:11,代码来源:Program.cs


示例8: MasterMind

        /// <summary>
        /// Default constructor for MasterMind class. Initializes variables
        /// </summary>
        /// <param name="display">display module</param>
        /// <param name="joystick">joystick module</param>
        /// <param name="button">button module</param>
        /// <param name="led">led module</param>
        public MasterMind(Gadgeteer.Modules.Module.DisplayModule display, Gadgeteer.Modules.GHIElectronics.Joystick joystick,
            Gadgeteer.Modules.GHIElectronics.Button button, Gadgeteer.Modules.GHIElectronics.MulticolorLED led)
        {
            //storing device referenceslocally ingame logic.
            this.display = display;
            this.joystick = joystick;
            this.led = led;
            this.button = button;

            //game restart button
            button.ButtonPressed += button_ButtonPressed;
        }
开发者ID:pranay22,项目名称:tu-darmstadt-TK3,代码行数:19,代码来源:MasterMind.cs


示例9: CameraClass

        public CameraClass(Gadgeteer.Modules.GHIElectronics.Camera camera, Motion_Sensor motion_Sensor, Wifi wf)
        {
            this.wifi = wf;
            this.camera = camera;
            this.camera.CurrentPictureResolution = Camera.PictureResolution.Resolution160x120;
            this.motion_Sensor = motion_Sensor;
            this.motion_Sensor.Motion_Sensed += new GTM.Motion_Sensor.Motion_SensorEventHandler(motion_Sensor_Motion_Sensed);
            this.camera.PictureCaptured += new Camera.PictureCapturedEventHandler(camera_PictureCaptured);
            this.camera.DebugPrintEnabled = false;

            timer = new GT.Timer(sleepTime);
            timer.Tick += timer_Tick;
        }
开发者ID:jfcaiceo,项目名称:HomeSecurityGadgeteer,代码行数:13,代码来源:CameraClass.cs


示例10: _getReading_Tick

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


示例11: 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


示例12: 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


示例13: 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


示例14: 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


示例15: 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


示例16: _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


示例17: 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


示例18: 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


示例19: monitor_Tick

 void monitor_Tick(GT.Timer timer)
 {
     int currentdistance = distance.GetDistanceInCentimeters();
     Debug.Print("Current distance : " + currentdistance);
     if (currentdistance <= 20)
     {
         serial.WriteLine("SYou are too close at " + currentdistance + " centimeters. Please move back");
     }
 }
开发者ID:marinehero,项目名称:SpeechAlarm,代码行数:9,代码来源:Program.cs


示例20: DataReceived

 void DataReceived(GT.Interfaces.Serial sender, System.IO.Ports.SerialData data)
 {
     int BytesToRead = usbSerial.SerialLine.BytesToRead;
     byte[] Buffer = new byte[BytesToRead];
     usbSerial.SerialLine.Read(Buffer, 0, BytesToRead);
     Debug.Print("Data received: " + BytesToRead + " Bytes");
     String BufferString = "DATA: " + ByteArrayToString(Buffer);
     Debug.Print(BufferString);
 }
开发者ID:TheLurps,项目名称:UsbSerial,代码行数:9,代码来源:Program.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Game类代码示例发布时间:2022-05-24
下一篇:
C# GZipStream类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap