 #include <SoftwareSerial.h>
-#define PPRON 1
-#define PPROFF 2
-#define FSRON 3
-#define FSROFF 4
-#define TMPUP 5
-#define TMPDOWN 6
+#define PPR_ON 1
+#define PPR_OFF 2
+#define FSR_ON 3
+#define FSR_OFF 4
+#define TMP_UP 5
+#define TMP_DOWN 6
 int INA = 9;  
 int INB = 8;
 int LED = 5; // LED를 5번핀에 연결합니다.
 int PRESSURE = A0;
 int TEMPERATURE = A1;
 int MOSFET = 7 ;
+
 bool isFSROn = false;
-float Val;
-float val;
+bool isTMPOn = false;
+float currTmp;
+int MAX_TEMP;
 SoftwareSerial BTSerial(2, 3);
 
 void setup() {

  if(BTSerial.available()){
      byte response = BTSerial.read();
      switch(response){
        case PPRON :{
          Serial.println(response);
          digitalWrite(INA,HIGH);
          digitalWrite(INB,LOW); 
          break;
        }
        case PPROFF :{
          Serial.println(response);
          digitalWrite(INA,LOW);
          digitalWrite(INB,LOW); 
          break;
        }
        case FSRON :{
          Serial.println(response);
          isFSROn= true;
          break;
        }
        case FSROFF :{
          Serial.println(response);
          isFSROn = false;
          break;
        }
        case TMPUP :{
          Serial.println(response);
          break;
        }
        case TMPDOWN :{
          Serial.println(response);
          break;
        }
      }
      
  }
  if(isFSROn){
    int fsrData = analogRead(PRESSURE);
    Serial.println("Temperature : "+ String(fsrData));

    delay(1000);
  }
}

void temperature(int MAX_TEMP){
  float analogTmp = (float)analogRead(TEMPERATURE)*5/1024;
  currTmp = 100*(analogTmp-0.5);
  if(currTmp < MAX_TEMP){
    digitalWrite(MOSFET,HIGH);
  }else{
    digitalWrite(MOSFET,LOW);
  }
}

