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: "PWM Setup"
- - Source Code compiled for: Arduino Uno
- - Source Code created on: 2024-02-23 08:29:45
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* Speed control of AC motor, by varying the PWM duty */
- /* cycles */
- /****** END SYSTEM REQUIREMENTS *****/
- /****** DEFINITION OF LIBRARIES *****/
- #include <Arduino.h> // Include the Arduino library
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- void updateOutputs(void);
- /***** DEFINITION OF PWM OUTPUT PINS *****/
- const uint8_t PWM1_PIN_D3 = 3;
- /***** DEFINITION OF OUTPUT RAW VARIABLES *****/
- /***** Used to store raw data *****/
- uint8_t PWM1_PIN_D3_rawData = 0;
- /***** DEFINITION OF OUTPUT PHYSICAL VARIABLES *****/
- /***** Used to store data after characteristic curve transformation *****/
- float PWM1_PIN_D3_phyData = 0.0;
- void setup(void) {
- // Set the PWM1_PIN_D3 pin as an output
- pinMode(PWM1_PIN_D3, OUTPUT);
- }
- void loop(void) {
- // Put your main code here, to run repeatedly:
- updateOutputs(); // Refresh output data
- }
- void updateOutputs(void) {
- // Update the analog output on PWM1_PIN_D3 based on the raw data value
- analogWrite(PWM1_PIN_D3, PWM1_PIN_D3_rawData);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement