Transform Unity Object with Arduino
OK i will give it another try. i really hope you can help me guys!
I want to transform an Unity Object (cube, want to scale it) with the output of my arduino serial. means: arduino gives me all the time a lot of numbers and i want to use them as the scalefactor for my geometry.
Arduino Code: `void setup() { // put your setup code here, to run once: Serial.begin(9600); }
void loop() { // put your main code here, to run repeatedly: int a = analogRead(A0); //Sleep for 50ms, which provides the recommended sample rate (20Hz) delay(1000); Serial.println(a); } '
Unity Code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO.Ports;
public class Arduino : MonoBehaviour
{
??????????? //what should i put in here
SerialPort serial = new SerialPort("COM3", 9600);
void Start()
{
serial.Open();
serial.ReadTimeout = 1000;
}
void Update()
{
????? //what should i put in here
}
}
would be nice to have smooth transition. should look like an animation of the cube
i really have no idea how wo do this! and i'm not good at scripting.
thanks guys
Your answer
Follow this Question
Related Questions
Splitting script to send signal to arduino 0 Answers
Not Fully Understanding how To Correctly Receive LDR Arduino Data 0 Answers
Get Temperature Value and Prompt an Action 0 Answers
use two mpu6050 0 Answers