Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********* Pleasedontcode.com **********
- Pleasedontcode thanks you for automatic code generation! Enjoy your code!
- - Terms and Conditions:
- You have a non-exclusive, revocable, worldwide, royalty-free license
- for personal and commercial use. Attribution is optional; modifications
- are allowed, but you're responsible for code maintenance. We're not
- liable for any loss or damage. For full terms,
- please visit pleasedontcode.com/termsandconditions.
- - Project: "Temperature Tracker"
- - Source Code compiled for: Arduino Uno
- - Source Code created on: 2024-03-05 22:40:56
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* I integrate the JDY-31 Bluetooth module with your */
- /* Arduino Uno R3, along with a thermistor */
- /* temperature sensor write a code that reads the */
- /* resistnace from the thermistor, converts it to */
- /* temprature using this equation y = */
- /* 25.76e^-0.039x,where y is the T */
- /****** END SYSTEM REQUIREMENTS *****/
- /****** DEFINITION OF LIBRARIES *****/
- #include <SoftwareSerial.h>
- #include <math.h>
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- /***** DEFINITION OF Software Serial *****/
- const uint8_t JDY31_HC05_mySerial_PIN_SERIAL_TX_A0 = A0;
- const uint8_t JDY31_HC05_mySerial_PIN_SERIAL_RX_A1 = A1;
- SoftwareSerial JDY31_HC05_mySerial(JDY31_HC05_mySerial_PIN_SERIAL_RX_A1, JDY31_HC05_mySerial_PIN_SERIAL_TX_A0);
- // Define the pins for the thermistor
- const int thermistorPin = A2;
- void setup(void)
- {
- // put your setup code here, to run once:
- JDY31_HC05_mySerial.begin(9600);
- Serial.begin(9600); // Initialize the Serial Monitor
- }
- void loop(void)
- {
- // put your main code here, to run repeatedly:
- // Read the resistance from the thermistor
- int thermistorValue = analogRead(thermistorPin);
- // Convert the resistance to temperature using the equation y = 25.76e^-0.039x
- float temperature = 25.76 * exp(-0.039 * thermistorValue);
- // Print the temperature to the Serial Monitor
- Serial.print("Temperature: ");
- Serial.print(temperature);
- Serial.println(" degrees Celsius");
- // Delay for 1 second
- delay(1000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement