Advertisement
pleasedontcode

Temperature Control rev_01

May 4th, 2024
772
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /********* Pleasedontcode.com **********
  2.  
  3.     Pleasedontcode thanks you for automatic code generation! Enjoy your code!
  4.  
  5.     - Terms and Conditions:
  6.     You have a non-exclusive, revocable, worldwide, royalty-free license
  7.     for personal and commercial use. Attribution is optional; modifications
  8.     are allowed, but you're responsible for code maintenance. We're not
  9.     liable for any loss or damage. For full terms,
  10.     please visit pleasedontcode.com/termsandconditions.
  11.  
  12.     - Project: Temperature Control
  13.     - Source Code NOT compiled for: Arduino Uno
  14.     - Source Code created on: 2024-05-04 08:22:30
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* Turn light on off */
  21. /****** END SYSTEM REQUIREMENTS *****/
  22.  
  23. /****** DEFINITION OF LIBRARIES *****/
  24. #include <DS18B20.h>
  25. #include <MCP23017.h>
  26.  
  27. /***** DEFINITION OF DIGITAL INPUT PINS *****/
  28. const uint8_t Test_DS18B20_DQ_PIN_D2 = 2;
  29.  
  30. /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
  31. DS18B20 ds(Test_DS18B20_DQ_PIN_D2);
  32. MCP23017 ioExpander;
  33.  
  34. void setup(void)
  35. {
  36.     // Initialize MCP23017
  37.     ioExpander.begin();
  38.  
  39.     // Set pin modes for MCP23017
  40.     ioExpander.pinMode(8, INPUT_PULLUP); // Replace pin numbers as required
  41.     ioExpander.pinMode(9, INPUT_PULLUP);
  42.     ioExpander.pinMode(0, OUTPUT);
  43.     ioExpander.pinMode(1, OUTPUT);
  44.  
  45.     // Set initial digital outputs
  46.     ioExpander.digitalWrite(0, LOW);
  47.     ioExpander.digitalWrite(1, LOW);
  48. }
  49.  
  50. void loop(void)
  51. {
  52.     // Check input pin value and update output pins on the MCP23017
  53.     ioExpander.digitalWrite(0, !ds.getTempC());  // Placeholder logic - change as needed
  54.     ioExpander.digitalWrite(1, ds.getTempC());   // Placeholder logic - change as needed
  55. }
  56.  
  57. /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement