void loop(){
int input=(analogRead(0)*20);
Serial.println(input);
analogWrite(green,input);
if (input>2){
digitalWrite(green,HIGH);
}
else
{
digitalWrite(green,LOW);
}
analogWrite(yellow,input);
if (input>300){
digitalWrite(yellow,HIGH);
}
else
{
digitalWrite(yellow,LOW);
}
analogWrite(orange,input);
if (input>500){
digitalWrite(orange,HIGH);
}
else;
{
digitalWrite(orange,LOW);
}
analogWrite(red,input);
if (input>700){
digitalWrite(red,HIGH);
}
else;
{
digitalWrite(red,LOW);
}
analogWrite(redflashing,input);
if (input>900){
digitalWrite(redflashing,HIGH);
delay(100);
digitalWrite(redflashing,LOW);
delay(100);
}
else;
{
digitalWrite(redflashing,LOW);
}
}
at the moment the stress sensor is not calibrated, as i am working on the coding (as stressful as it is) i can't make myself the really really stressed on demand! so its calibrated at a very low level so i can test the lights and pins are all functioning and responding correcly. thats why i have multiplied the input by 20, in a really life situation i think 5 would be enough (though as discussed earlier stress levels are recorded differently from different people regardless of how stressed they are, so a way of personal calibration would have be best)
No comments:
Post a Comment