apl-mhd

Sender

Jun 8th, 2021
840
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <LiquidCrystal.h>
  2. LiquidCrystal lcd(12,11,5,4,3,2);
  3.  
  4. int a = 0;
  5. int celsius;
  6. int pulseRate;
  7.  
  8.  
  9. void setup(){
  10.   Serial.begin(1156200);
  11.   Serial.flush();
  12.  
  13.   lcd.begin(16,2);
  14.   lcd.clear();
  15.   //lcd.setCursor(0,0);
  16.   //lcd.print("Arduino Serial");
  17.   //lcd.setCursor(0,1);
  18.   //lcd.print("on pin 0/1");
  19.  // delay(1000);
  20.  // lcd.clear();
  21.   //randomSeed(analogRead(0));
  22.   //lcd.setCursor(0,0);
  23.  // lcd.print("Data sent");
  24.  
  25.   /* left side sensor for Temperature sensor*/
  26.   pinMode(A0, INPUT); // connected with analog pin A1
  27.  
  28.   /* Right side sensor for Pulse rate sensor*/
  29.  pinMode(A1, INPUT); // connected with analog pin A1
  30.  
  31.   /*Buzzer*/
  32.     pinMode(8, OUTPUT);
  33.  
  34. }
  35.  
  36.  
  37. void loop(){
  38.  
  39.  
  40.  
  41.   int randomChar = random(256);
  42.  
  43.  
  44.   pulseRate = map(((analogRead(A1) - 20) * 3.04), 0, 1023, -40, 125);
  45.   celsius = map(((analogRead(A0) - 20) * 3.04), 0, 1023, -40, 125);
  46.  //because i have converte temperature seonsor to pulse rate
  47.   // temp senseor value start from -40 to 125 degree celsius
  48.   pulseRate +=40;
  49.  
  50.     lcd.setCursor(0,0);
  51.     lcd.print("Temperature:");
  52.     lcd.setCursor(12,0);
  53.     lcd.print(celsius);
  54.  
  55.       lcd.setCursor(0,1);
  56.     lcd.print("Pulse Rate:");
  57.         lcd.setCursor(12,1);
  58.     lcd.print(pulseRate);
  59.  
  60.  
  61.   if((pulseRate<60 || pulseRate > 120) || (celsius < 30 || celsius > 37)){
  62.  
  63.         tone(8, 1000);
  64.         delay(1000);
  65.         noTone(8);
  66.         //delay(1000);
  67.    
  68.     Serial.write("Patient trouble");
  69.    
  70.   }
  71.  
  72.  
  73.  
  74.  
  75.   String x = "aa";
  76.   Serial.println();
  77.  
  78.  
  79.  
  80.  
  81.   if(a ==0){
  82.     //Serial.write(celsius);
  83.     a =1;
  84.     //delay(3000);
  85.   }
  86.    
  87. }
RAW Paste Data