Last active
August 29, 2015 14:02
-
-
Save takahi5/c0484bc78b5136b68c43 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using Uniduino; | |
public class BlinkyLight : MonoBehaviour { | |
public Arduino arduino; | |
// Use this for initialization | |
void Start () { | |
arduino = Arduino.global; | |
arduino.Setup(ConfigurePins); | |
} | |
void ConfigurePins( ) | |
{ | |
arduino.pinMode (9, PinMode.PWM); //vibration motor | |
} | |
// Update is called once per frame | |
void Update () { | |
if (Input.GetKey(KeyCode.Q)){ | |
arduino.analogWrite(9, 255); | |
} else if (Input.GetKey(KeyCode.W)){ | |
arduino.analogWrite(9, 0); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment