2

Considering the GSR is the inverse of the Resistance, if I know the resistance and how much it increases for every celsius degree, the game would be done. Here's how my code looks like at the moment:

const int GSR=A0;
int threshold=0;
int sensorValue;
const long interval = 1000; 
unsigned long T = millis();


void setup(){
  long sum=0;
  Serial.begin(115200);
  delay(1000);

  for(int i=0;i<500;i++)
  {
  sensorValue=analogRead(GSR);
  sum += sensorValue;
  delay(5);
  }
  threshold = sum/500;
   Serial.print("threshold =");
   Serial.println(threshold);
  }

void loop(){


  if( millis() - T >= 250)  {
   int temp;
  sensorValue=analogRead(GSR);
  Serial.println(sensorValue);
  temp = threshold - sensorValue;
  T = millis();

  }
  }

The page of the sensor: http://www.seeedstudio.com/wiki/Grove_-_GSR_Sensor

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.