Advertisement
pleasedontcode

**Transformer Control** rev_01

May 30th, 2025
358
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: **Transformer Control**
  13.     - Source Code NOT compiled for: ESP32 DevKit V1
  14.     - Source Code created on: 2025-05-30 07:14:30
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* fix my code, it doesnt compile in esp idf 5.4.1, */
  21.     /* it for driving transformer using full bridge with */
  22.     /* ir2113 driver */
  23. /****** END SYSTEM REQUIREMENTS *****/
  24.  
  25. /* START CODE */
  26.  
  27. /****** DEFINITION OF LIBRARIES *****/
  28. #include <Arduino.h>
  29. #include "IR2113.h"  // Include the IR2113 driver library
  30.  
  31. /****** FUNCTION PROTOTYPES *****/
  32. void setup(void);
  33. void loop(void);
  34.  
  35. // Define the pins for the IR2113 driver
  36. const int highSideGatePin = 9;  // Example pin for high side gate
  37. const int lowSideGatePin = 10;   // Example pin for low side gate
  38.  
  39. IR2113 ir2113(highSideGatePin, lowSideGatePin); // Instantiate the IR2113 driver
  40.  
  41. void setup(void)
  42. {
  43.     // Initialize the IR2113 driver
  44.     ir2113.begin();
  45.    
  46.     // Set the initial state of the gates
  47.     ir2113.setHighSideGate(LOW);
  48.     ir2113.setLowSideGate(LOW);
  49. }
  50.  
  51. void loop(void)
  52. {
  53.     // Example logic to drive the transformer
  54.     // This can be modified based on your requirements
  55.     ir2113.setHighSideGate(HIGH); // Turn on the high side gate
  56.     delay(1000);                   // Wait for 1 second
  57.     ir2113.setHighSideGate(LOW);  // Turn off the high side gate
  58.     ir2113.setLowSideGate(HIGH);  // Turn on the low side gate
  59.     delay(1000);                   // Wait for 1 second
  60.     ir2113.setLowSideGate(LOW);   // Turn off the low side gate
  61. }
  62.  
  63. /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement