/********* 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 Integration - Source Code compiled for: Arduino Nano - Source Code created on: 2024-01-12 10:34:00 ********* Pleasedontcode.com **********/ /****** SYSTEM REQUIREMENTS *****/ /****** SYSTEM REQUIREMENT 1 *****/ /* potentiometer value is mapped to led brightness */ /****** END SYSTEM REQUIREMENTS *****/ /****** DEFINITION OF LIBRARIES *****/ #include #include /****** FUNCTION PROTOTYPES *****/ void setup(void); void loop(void); /***** DEFINITION OF ANALOG INPUT PINS *****/ const uint8_t pot1_Potentiometer_Vout_PIN_A0 = A0; /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/ ForcedBME280Float climateSensor; uint8_t ledPin = 9; void setup(void) { // put your setup code here, to run once: pinMode(pot1_Potentiometer_Vout_PIN_A0, INPUT); pinMode(ledPin, OUTPUT); // Initialize the climate sensor Wire.begin(); while (climateSensor.begin()) { delay(1000); } } void loop(void) { // put your main code here, to run repeatedly: int potValue = analogRead(pot1_Potentiometer_Vout_PIN_A0); int brightness = map(potValue, 0, 1023, 0, 255); analogWrite(ledPin, brightness); // Climate sensor measurements climateSensor.takeForcedMeasurement(); float temperature = climateSensor.getTemperatureCelsiusAsFloat(true); float pressure = climateSensor.getPressureAsFloat(); float humidity = climateSensor.getRelativeHumidityAsFloat(); // Print temperature Serial.print("Temperature: "); Serial.print(temperature); Serial.println(" °C"); // Print pressure Serial.print("Pressure: "); Serial.print(pressure); Serial.println(" hPa"); // Print humidity Serial.print("Humidity: "); Serial.print(humidity); Serial.println(" %rh"); delay(1000); }