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: "Pin Setup"
- - Source Code compiled for: ESP32 DevKit V1
- - Source Code created on: 2024-02-01 13:31:49
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* turn on DO0 when DI0 as true, turn on DO1 when DI1 */
- /* as true */
- /****** END SYSTEM REQUIREMENTS *****/
- /****** DEFINITION OF LIBRARIES *****/
- #include <Adafruit_MAX31865.h> //https://github.com/adafruit/Adafruit_MAX31865
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- void updateOutputs(void);
- /***** DEFINITION OF DIGITAL INPUT PINS *****/
- const uint8_t DI0_PushButton_PIN_D14 = 14;
- const uint8_t DI1_PushButton_PIN_D16 = 16;
- /***** DEFINITION OF ANALOG INPUT PINS *****/
- const uint8_t AI0_Potentiometer_Vout_PIN_D4 = 4;
- /***** DEFINITION OF DIGITAL OUTPUT PINS *****/
- const uint8_t DO0_LED_PIN_D17 = 17;
- const uint8_t DO1_LED_PIN_D18 = 18;
- /***** DEFINITION OF OUTPUT RAW VARIABLES *****/
- /***** used to store raw data *****/
- bool DO0_LED_PIN_D17_rawData = 0;
- bool DO1_LED_PIN_D18_rawData = 0;
- /***** DEFINITION OF OUTPUT PHYSICAL VARIABLES *****/
- /***** used to store data after characteristic curve transformation *****/
- float DO0_LED_PIN_D17_phyData = 0.0;
- float DO1_LED_PIN_D18_phyData = 0.0;
- /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
- Adafruit_MAX31865 max31865_sensor(10, 11, 12, 13); // Create instance of Adafruit_MAX31865 class
- void setup(void)
- {
- // put your setup code here, to run once:
- pinMode(DI0_PushButton_PIN_D14, INPUT_PULLUP);
- pinMode(DI1_PushButton_PIN_D16, INPUT_PULLUP);
- pinMode(AI0_Potentiometer_Vout_PIN_D4, INPUT);
- pinMode(DO0_LED_PIN_D17, OUTPUT);
- pinMode(DO1_LED_PIN_D18, OUTPUT);
- // Initialize the MAX31865 sensor
- max31865_sensor.begin(MAX31865_3WIRE); // Initialize the sensor with 3-wire configuration
- }
- void loop(void)
- {
- // put your main code here, to run repeatedly:
- bool DI0_Status = digitalRead(DI0_PushButton_PIN_D14); // Read the status of DI0
- bool DI1_Status = digitalRead(DI1_PushButton_PIN_D16); // Read the status of DI1
- // Update output raw data based on input status
- DO0_LED_PIN_D17_rawData = DI0_Status;
- DO1_LED_PIN_D18_rawData = DI1_Status;
- updateOutputs(); // Refresh output data
- }
- void updateOutputs()
- {
- digitalWrite(DO0_LED_PIN_D17, DO0_LED_PIN_D17_rawData);
- digitalWrite(DO1_LED_PIN_D18, DO1_LED_PIN_D18_rawData);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement