Loading...
  Show Posts
Pages: [1]
1  Using Arduino / Sensors / Meas sensor reading on: February 03, 2013, 11:39:14 pm
I have a circuit built using a Piezo vibration sensor large Meas with mass weight. I used the code similar to the knock sensor.

void setup()
{
  Serial.begin(9600); //
}
void loop()
{
      int val;
      val=analogRead(0);//Connect the sensor to analog pin 0
      //if (val>100)
      float rating = val*(500/1023.0);
      Serial.println(rating);
      //Serial.println(val,DEC);//
      //else Serial.println();
      delay(100);
}

It works very well and gives me streaming data to the serial monitor. What I can't figure out is a way to make it print just the highest value per impact. Each impact will occur and be followed by no activity for a couple seconds. Currently I am seeing pretty reliable data but I can't figure out what to do. I tried to change the delay and I tried to assign a value to different ranges without success.
Pages: [1]