.
2. Connect the LED to the pin 13 of your Arduino following this circuit.
##Setup Unity
1. Create a new scene
2. Add the prefab `Uduino` to your scene
3. Create a new C# script named *BlinkLed* and add it to a game object in the scene.
## Write the code
It's now time to create your first Uduino script.
1. First you need to reference Uduino in your script.
```csharp
using UnityEngine;
using System.Collections;
using Uduino; // adding Uduino NameSpace
public class BlinkLed: MonoBehaviour
{
UduinoManager u; // The instance of Uduino is initialized here
void Start() //... continue the code
}
```
2. On the Start function, configure the pin you are going to use. Pin 13 in this example.
```csharp
void Start()
{
UduinoManager.Instance.pinMode(13, PinMode.Output);
}
```
3. Add the code to blink the LED
```csharp
using UnityEngine;
using System.Collections;
using Uduino; // adding Uduino NameSpace
public class BlinkLed: MonoBehaviour
{
UduinoManager u; // The instance of Uduino is initialized here.
void Start()
{
UduinoManager.Instance.pinMode(13, PinMode.Output);
StartCoroutine(BlinkLed());
}
IEnumerator BlinkLed() {
while(true) {
UduinoManager.Instance.digitalWrite(13, State.HIGH);
yield return new WaitForSeconds(1);
UduinoManager.Instance.digitalWrite(13, State.LOW);
yield return new WaitForSeconds(1);
}
}
}
```
### Full script
BlinkLed.cs