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: **Sensor Readings**
- - Source Code NOT compiled for: Arduino Uno
- - Source Code created on: 2024-11-21 00:14:06
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* crear un portafolio de diseño visual con doce */
- /* fotos y texto describiéndome, que utilice colores */
- /* #4C000D #72071E #160002 y textos blancos */
- /****** END SYSTEM REQUIREMENTS *****/
- /* START CODE */
- /****** DEFINITION OF LIBRARIES *****/
- #include <forcedBMX280.h> //https://github.com/soylentOrange/Forced-BMX280
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
- // Instantiate the ForcedBMX280 object
- ForcedBMX280 sensor; // Default I2C address will be used
- void setup(void)
- {
- // Initialize the sensor
- if (sensor.begin() != ERROR_OK) {
- Serial.println("Sensor initialization failed!");
- while (1); // Stop the program
- }
- // Set up serial communication for debugging
- Serial.begin(9600);
- }
- void loop(void)
- {
- // Read temperature and humidity
- int32_t temperature = sensor.getTemperatureCelsius(true);
- uint32_t humidity = sensor.getRelativeHumidity(true);
- // Display the readings
- Serial.print("Temperature: ");
- Serial.print(temperature);
- Serial.println(" °C");
- Serial.print("Humidity: ");
- Serial.print(humidity);
- Serial.println(" %");
- // Add a delay for readability
- delay(2000);
- }
- /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement