x = analogRead(0); y = analogRead(1); z = analogRead(2);
// 센서에서 읽은 값을 -1~1 사이의 범위가 좁은 값으로 변환하기 위해
// 실수형으로 변수 선언하고 스케치 맨 하단 mapinfloat 함수를 호출을 통해 변환
// 그리고 -1~ 1 사이를 벗어나지 않도록 constrain 처리 float xsintheta = constrain(mapinfloat(x,268,406,-1,1),-1,1); float ysintheta = constrain(mapinfloat(y,267,406,-1,1),-1,1); float zsintheta = constrain(mapinfloat(z,275,412,-1,1),-1,1);
// -1~1 사이의 값을 각도 값으로 변환 float xtheta = asin(xsintheta)*180/PI; float ytheta = asin(ysintheta)*180/PI; float ztheta = asin(zsintheta)*180/PI;