コード例 #1
0
        public HttpResponseMessage Get(int player, float load)
        {
            try
            {
                string portName = "";

                if (player == 1)
                {
                    portName = SerialPortHelper.player1Port;
                }
                else
                {
                    portName = SerialPortHelper.player2Port;
                }

                intensity = SerialPortHelper.CreateIntensity(load);

                SerialPortHelper.WritePort(portName, intensity);

                resultTest = $"Player: {player} Port name: {portName} Intensity: {intensity}";

                return(Request.CreateResponse(HttpStatusCode.OK));
            }
            catch (System.Exception)
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError));
            }
        }