mirror of
				https://github.com/pmarchini/Esp32Dimmer.git
				synced 2025-10-31 11:24:03 +03:00 
			
		
		
		
	docs: documentation
This commit is contained in:
		
							
								
								
									
										61
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										61
									
								
								README.md
									
									
									
									
									
								
							| @@ -1,5 +1,55 @@ | |||||||
| # Esp32Dimmer | # ESP32IDFDimmer | ||||||
| Esp32-idf zerocrossing TRIAC dimmer library |  | ||||||
|  | This library provides an API to control dimmer devices using the ESP32IDF. It supports both toggle and normal modes, and allows you to set the power levels of the dimmer.  | ||||||
|  |  | ||||||
|  | ### Prerequisites | ||||||
|  | - ESP32 board with ESP-IDF v4.1 or higher | ||||||
|  | - A dimmable AC load  | ||||||
|  |  | ||||||
|  | ### Installation | ||||||
|  | Clone the project from the repository and add the library to your project.  | ||||||
|  |  | ||||||
|  | ### Usage | ||||||
|  | 1. Include the library header in your program  | ||||||
|  | ``` | ||||||
|  | #include "esp32idfDimmer.h" | ||||||
|  | ``` | ||||||
|  | 2. Instantiate the dimmers.  | ||||||
|  | ``` | ||||||
|  | dimmertyp *ptr_dimmer;  | ||||||
|  | dimmertyp *ptr_dimmer_2;  | ||||||
|  |  | ||||||
|  | ptr_dimmer = createDimmer(TRIAC_1_GPIO, ZEROCROSS_GPIO); | ||||||
|  | ptr_dimmer_2 = createDimmer(TRIAC_2_GPIO, ZEROCROSS_GPIO); | ||||||
|  | ```  | ||||||
|  | 3. Start the dimmers.  | ||||||
|  | ``` | ||||||
|  | begin(ptr_dimmer, NORMAL_MODE, ON, _50Hz); | ||||||
|  | begin(ptr_dimmer_2, NORMAL_MODE, ON, _50Hz); | ||||||
|  | ``` | ||||||
|  | 4. Set or get the power of the dimmers.  | ||||||
|  | ``` | ||||||
|  | // Set the power level to 50  | ||||||
|  | setPower(ptr_dimmer, 50);  | ||||||
|  |  | ||||||
|  | // Get the current power level  | ||||||
|  | int powerLevel = getPower(ptr_dimmer);  | ||||||
|  | ```  | ||||||
|  |  | ||||||
|  | ## API | ||||||
|  |  | ||||||
|  | The library provides the following API methods: | ||||||
|  |  | ||||||
|  | * `createDimmer` - creates a new dimmer object | ||||||
|  | * `begin` - starts the dimmer | ||||||
|  | * `setPower` - sets the power level of the dimmer | ||||||
|  | * `getPower` - gets the current power level of the dimmer | ||||||
|  | * `setState` - sets the state of the dimmer (on/off) | ||||||
|  | * `getState` - gets the current state of the dimmer | ||||||
|  | * `changeState` - changes the state of the dimmer (on/off) | ||||||
|  | * `setMode` - sets the mode of the dimmer (toggle/normal) | ||||||
|  | * `getMode` - gets the current mode of the dimmer | ||||||
|  | * `toggleSettings` - sets the toggle range of the dimmer | ||||||
|  |  | ||||||
| ## Example schematics | ## Example schematics | ||||||
|  |  | ||||||
| @@ -11,3 +61,10 @@ Esp32-idf zerocrossing TRIAC dimmer library | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | ## Contributing  | ||||||
|  |  | ||||||
|  | We welcome contributions to this library. Please open a pull request or an issue to get started.  | ||||||
|  |  | ||||||
|  | ## License  | ||||||
|  |  | ||||||
|  | This library is released under the MIT License. | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Pietro Marchini
					Pietro Marchini