Created
October 1, 2014 13:59
-
-
Save takahi5/b64acfde02b524016118 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 ArduinoController : MonoBehaviour { | |
public Arduino arduino; | |
// 8番ピン | |
int FOOT_SWITCH_PIN = 8; | |
void Start () { | |
arduino = Arduino.global; | |
arduino.Setup (ConfigurePins); | |
} | |
void ConfigurePins( ) | |
{ | |
// 8番ピンを入力モードに | |
arduino.pinMode (FOOT_SWITCH_PIN, PinMode.INPUT); | |
arduino.reportDigital((byte)(FOOT_SWITCH_PIN/8), 1); | |
} | |
void Update () { | |
// スイッチが押されたら何かする | |
if(arduino.digitalRead(FOOT_SWITCH_PIN) == 1){ | |
execTurubo(); // ターボ発動!! | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment