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: # Plasma Controller
- - Source Code compiled for: ESP32 DevKit V1
- - Source Code created on: 2026-01-17 16:47:03
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* buat progres THC_rotary bisa di kontrol dengan */
- /* web server melalui wifi */
- /****** END SYSTEM REQUIREMENTS *****/
- /* START CODE */
- // System Requirements: THC (Torch Height Controller) system with plasma cutting control
- // Main Arduino sketch for ESP32 THC remote control system
- // Includes timer setup, interrupt handling, and initialization of all subsystems
- #include "globals.h"
- // ===== Timer Callback Function =====
- // Triggered by esp_timer every 10ms to set the Do flag for periodic tasks
- void onTimerCallback(void* arg) {
- Do = true;
- }
- // ===== Timer Setup Function =====
- // Configures the ESP32 high-resolution timer to interrupt every 10ms
- void Setup_Timer2() {
- // Setting structure for the timer
- esp_timer_create_args_t timer_args = {
- .callback = &onTimerCallback,
- .name = "my_periodic_timer"
- };
- // Create the timer
- ESP_ERROR_CHECK(esp_timer_create(&timer_args, &timer_handle));
- // Start the timer. It will repeat every 10,000 microseconds (10ms)
- ESP_ERROR_CHECK(esp_timer_start_periodic(timer_handle, 10000));
- }
- // ===== Arduino Setup Function =====
- // Called once when the microcontroller starts
- void setup() {
- // Initialize serial communication for debugging
- Serial.begin(115200);
- delay(1000);
- // Initialize all subsystems
- Setup_LCD();
- Setup_Encoder();
- Setup_THC();
- ReadProg();
- // Initialize the timer for periodic interrupt
- Setup_Timer2();
- }
- // ===== Arduino Main Loop =====
- // Continuous loop that executes after setup()
- void loop() {
- // Check encoder button for menu navigation
- checkButton();
- // Process menu selection based on encoder button
- checkMenu();
- // Update LCD display
- doLCD();
- // Process THC logic (arc voltage control and torch height adjustment)
- doTHC();
- // Read arc voltage from ADC
- ArcV = analogRead(arcVoltagePin);
- }
- /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment