- Home /
How to write : Rotate and Reset
I make the game with a servo motor, so I connected Arduino to Unity by UDUINO. And I want to rotate a servo moter 255 to 0 when W key pressed.
Here is the code but of course only move 255. What should I add?
 using UnityEngine;
 using System.Collections;
 using Uduino;
 
 public class testoo : MonoBehaviour {
 
     [Range(0,255)]
     public int servoValue;
 
     void Start () {
         UduinoManager.Instance.pinMode (9, PinMode.Servo);   
     }
 
     void Update () {
         if (Input.GetKey (KeyCode.W)) {
             UduinoManager.Instance.analogWrite (9, 255);
 
         }
     }
 }
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
Flip over an object (smooth transition) 3 Answers
How i can equal 2 Tranform Rotations? 1 Answer
transform.rotation = ... reacts slow 2 Answers
Rotation for 180 degrees of character 1 Answer
Rotating a model with increments 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                