public PushButton(IArduino board, int pin, ITimer timer = null)
     : base(board, pin, timer)
 {
     SetPinMode(PinMode.Input);
     SetDefaults();
     Setup(board, pin);
 }
Exemple #2
0
 public void Setup()
 {
     _arduino = A.Fake <IArduino>();
     _timer   = new FakeTimer();
     _led     = new LedPwm(_arduino, Pin, _timer);
     _led.Intensity.ShouldEqual(0);
 }
Exemple #3
0
 /// <param name='operations'>
 /// Reference to the ArduinoAPI.IArduino.
 /// </param>
 /// <param name='token'>
 /// Required.
 /// </param>
 public static string LimparByToken(this IArduino operations, string token)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IArduino)s).LimparByTokenAsync(token);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
        public void Execute(IArduino arduino)
        {
            var redLight   = new DigitalWriteRequest(1, ArduinoDriver.DigitalValue.Low);
            var greenLight = new DigitalWriteRequest(2, ArduinoDriver.DigitalValue.Low);

            arduino.Send(redLight);
            arduino.Send(greenLight);
        }
Exemple #5
0
 /// <param name='operations'>
 /// Reference to the ArduinoAPI.IArduino.
 /// </param>
 /// <param name='idCliente'>
 /// Required.
 /// </param>
 public static IList <SalaDeReuniao> GetClienteByIdcliente(this IArduino operations, int idCliente)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IArduino)s).GetClienteByIdclienteAsync(idCliente);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
Exemple #6
0
 /// <param name='operations'>
 /// Reference to the ArduinoAPI.IArduino.
 /// </param>
 /// <param name='smtp'>
 /// Required.
 /// </param>
 /// <param name='haspeople'>
 /// Required.
 /// </param>
 public static string PostBySmtpAndHaspeople(this IArduino operations, string smtp, string haspeople)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IArduino)s).PostBySmtpAndHaspeopleAsync(smtp, haspeople);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
Exemple #7
0
        public void Execute(IArduino arduino)
        {
            var leftWheel  = new DigitalWriteRequest(1, ArduinoDriver.DigitalValue.Low);
            var rightWheel = new DigitalWriteRequest(2, ArduinoDriver.DigitalValue.Low);

            arduino.Send(rightWheel);
            arduino.Send(leftWheel);
        }
        public GestureRecognition()
        {
            _list = new List <TimePointF>();

            _arduino               = new Arduino.Arduino("COM3");
            _arduino.TapRecieved  += TapRecieved;
            _arduino.DataRecieved += DetectScrolls;
        }
Exemple #9
0
        public MainWindow()
        {
            _points = new List <TimePointF>();

            //TODO - Remove comment for real arduino
            _arduino = new Arduino("COM3");

            InitializeComponent();
        }
Exemple #10
0
 public LedRGB(IArduino board, int[] pins, ITimer timer = null)
     : base(board, pins, timer)
 {
     if (pins.Length != 3)
     {
         throw new ArgumentException("Expecting 3 pins", "pins");
     }
     _redPin = pins[0];
     _greenPin = pins[1];
     _bluePin = pins[2];
     SetPinMode(PinMode.Pwm);
 }
Exemple #11
0
 public LedRGB(IArduino board, int[] pins, ITimer timer = null)
     : base(board, pins, timer)
 {
     if (pins.Length != 3)
     {
         throw new ArgumentException("Expecting 3 pins", "pins");
     }
     _redPin   = pins[0];
     _greenPin = pins[1];
     _bluePin  = pins[2];
     SetPinMode(PinMode.Pwm);
 }
Exemple #12
0
        public Arduino()
        {
            InitializeComponent();
            arduino = DependencyService.Get <IArduino>();
            ConnectionMethodPicker.SelectedIndexChanged += ConnectionPickerSelectionChanged;

            if (Device.RuntimePlatform == Device.UWP)
            {
                var def = new ColumnDefinition();
                def.Width = GridLength.Star;
                ButtonGrid.ColumnDefinitions.Add(def);

                var button = new Button();
                button.Text = "Back";
                Grid.SetColumn(button, 3);
                ButtonGrid.Children.Add(button);
                button.Clicked += BackButtonClicked;
            }
        }
        private void Setup(IArduino board, int pin)
        {
            SetInterval(() =>
            {
                var isDown  = board.DigitalRead(pin) == 1;
                var wasDown = IsDown;

                if (!wasDown && isDown)
                {
                    IsDown = true;
                    Down();
                }
                else if (wasDown && !isDown)
                {
                    IsDown = false;
                    Up();
                }
            }, 5);
        }
Exemple #14
0
        public async Task Execute(IArduino arduino)
        {
            var leftWheelOn  = new DigitalWriteRequest(1, ArduinoDriver.DigitalValue.High);
            var leftWheelOff = new DigitalWriteRequest(1, ArduinoDriver.DigitalValue.Low);

            var rightWheelOn  = new DigitalWriteRequest(2, ArduinoDriver.DigitalValue.High);
            var rightWheelOff = new DigitalWriteRequest(2, ArduinoDriver.DigitalValue.Low);

            Task delay = Task.Delay(2000);

            Task task1 = new Task(async() => {
                arduino.Send(leftWheelOff);
                arduino.Send(rightWheelOn);
            });

            Task task2 = new Task(async() => {
                arduino.Send(leftWheelOn);
                arduino.Send(rightWheelOn);
            });

            await task1;
            await delay;
            await task2;
        }
Exemple #15
0
 public ViewModel(IArduino arduino)
 {
     arduino.DataRecieved += ArduinoDataRecievedHandler;
 }
Exemple #16
0
 public Engine(ICommandProcessor commandProcessor, IArduino arduino)
 {
     _CommandProcessor = commandProcessor;
     _Arduino          = arduino;
 }
Exemple #17
0
 public DownKeyCommand(IArduino arduino) : base(arduino)
 {
     OutCommands.Add(new TestLightOffCommand());
 }
Exemple #18
0
 public Led(IArduino board, int pin, ITimer timer = null)
     : base(board, pin, timer)
 {
     SetPinMode(PinMode.Output);
 }
Exemple #19
0
 public LedPwm(IArduino board, int pin, ITimer timer = null)
     : base(board, pin, timer)
 {
     SetPinMode(PinMode.Pwm);
 }
 public SinglePinComponent(IArduino board, int pin, ITimer timer = null)
     : base(board, timer)
 {
     Pin = pin;
 }
 public Component(IArduino board, ITimer timer)
 {
     Board = board;
     _timer = timer ?? new Timer();
 }
Exemple #22
0
        /// <param name='operations'>
        /// Reference to the ArduinoAPI.IArduino.
        /// </param>
        /// <param name='smtp'>
        /// Required.
        /// </param>
        /// <param name='haspeople'>
        /// Required.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <string> PostBySmtpAndHaspeopleAsync(this IArduino operations, string smtp, string haspeople, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse <string> result = await operations.PostBySmtpAndHaspeopleWithOperationResponseAsync(smtp, haspeople, cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
Exemple #23
0
 public Component(IArduino board, ITimer timer)
 {
     Board  = board;
     _timer = timer ?? new Timer();
 }
Exemple #24
0
        /// <param name='operations'>
        /// Reference to the ArduinoAPI.IArduino.
        /// </param>
        /// <param name='idCliente'>
        /// Required.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <IList <SalaDeReuniao> > GetClienteByIdclienteAsync(this IArduino operations, int idCliente, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse <System.Collections.Generic.IList <ArduinoAPI.Models.SalaDeReuniao> > result = await operations.GetClienteByIdclienteWithOperationResponseAsync(idCliente, cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
 public void Setup()
 {
     _arduino = A.Fake <IArduino>();
     _timer   = new FakeTimer();
     _led     = new Led(_arduino, Pin, _timer);
 }
Exemple #26
0
 public LedPwm(IArduino board, int pin, ITimer timer = null)
     : base(board, pin, timer)
 {
     SetPinMode(PinMode.Pwm);
 }
 public SinglePinComponent(IArduino board, int pin, ITimer timer = null)
     : base(board, timer)
 {
     Pin = pin;
 }
Exemple #28
0
        /// <param name='operations'>
        /// Reference to the ArduinoAPI.IArduino.
        /// </param>
        /// <param name='token'>
        /// Required.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <string> LimparByTokenAsync(this IArduino operations, string token, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse <string> result = await operations.LimparByTokenWithOperationResponseAsync(token, cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
Exemple #29
0
 public LedBase(IArduino board, int pin, ITimer timer = null)
     : base(board, pin, timer)
 {
     OnStateChanged = state => { };
     Off();
 }
Exemple #30
0
 public HeartbeatService(IArduino arduino)
 {
     _arduino = arduino;
 }
Exemple #31
0
 public Led(IArduino board, int pin, ITimer timer = null)
     : base(board, pin, timer)
 {
     SetPinMode(PinMode.Output);
 }
Exemple #32
0
 /// <summary>
 /// Initializes a new instance of the FusionExchangeArduino class.
 /// </summary>
 public FusionExchangeArduino()
     : base()
 {
     this._arduino = new Arduino(this);
     this._baseUri = new Uri("https://Fusionexchangearduino.azurewebsites.net");
 }
Exemple #33
0
 public LedRGB(IArduino board, int redPin, int greenPin, int bluePin, ITimer timer = null)
     : this(board, new[] {redPin, greenPin, bluePin}, timer)
 {
 }
Exemple #34
0
 /// <summary>
 /// Initializes a new instance of the FusionExchangeArduino class.
 /// </summary>
 /// <param name='rootHandler'>
 /// Optional. The http client handler used to handle http transport.
 /// </param>
 /// <param name='handlers'>
 /// Optional. The set of delegating handlers to insert in the http
 /// client pipeline.
 /// </param>
 public FusionExchangeArduino(HttpClientHandler rootHandler, params DelegatingHandler[] handlers)
     : base(rootHandler, handlers)
 {
     this._arduino = new Arduino(this);
     this._baseUri = new Uri("https://Fusionexchangearduino.azurewebsites.net");
 }
 public LedBase(IArduino board, int pin, ITimer timer = null)
     : base(board, pin, timer)
 {
     OnStateChanged = state => { };
     Off();
 }
 public MultiPinComponentcs(IArduino board, IEnumerable <int> pins, ITimer timer = null)
     : base(board, timer)
 {
     Pins = pins;
 }
Exemple #37
0
 public UpKeyCommand(IArduino arduino) : base(arduino)
 {
     OutCommands.Add(new TestLightOnCommand());
 }
 public MultiPinComponentcs(IArduino board, IEnumerable<int> pins, ITimer timer = null)
     : base(board, timer)
 {
     Pins = pins;
 }