###加速度センサを筋電センサの値で制御したい
Arduino、プログラミング初心者です。
Arduinoで、筋電センサがの数値が50以上プラスに動いた時だけ、加速度センサが反応するようにしたいです。
現在は、加速度センサと筋電センサの値を同時に読み取ることしかできません。
if文などを用いれば可能なのでしょうか…
該当のソースコード
C/C++
void setup()
{
Serial.begin(9600) ;
}
void loop()
{
long x , y , z ;
x = y = z = 0 ;
x = analogRead(3) ; // X軸
y = analogRead(4) ; // Y軸
z = analogRead(5) ; // Z軸
Serial.print("X:") ;
Serial.print(x) ;
Serial.print(" Y:") ;
Serial.print(y) ;
Serial.print(" Z:") ;
Serial.println(z) ;
delay(50) ;
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// print out the value you read:
Serial.println(sensorValue);
delay(1); // delay in between reads for stability
}
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。