单片机互通调试初步完成
This commit is contained in:
18
esp32_robot_firmware/relay_control.cpp
Normal file
18
esp32_robot_firmware/relay_control.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#include "relay_control.h"
|
||||
|
||||
void relay_setup() {
|
||||
pinMode(RELAY_PIN, OUTPUT);
|
||||
digitalWrite(RELAY_PIN, LOW); // 初始状态确保继电器是断开的 (假设LOW是断开)
|
||||
// 如果您的高低电平定义相反,请修改这里
|
||||
Serial.println("继电器已初始化,初始状态:断开。");
|
||||
}
|
||||
|
||||
void relay_start_charging() {
|
||||
digitalWrite(RELAY_PIN, HIGH); // 假设HIGH是闭合继电器
|
||||
Serial.println("继电器闭合 - 开始充电 (模拟)。");
|
||||
}
|
||||
|
||||
void relay_stop_charging() {
|
||||
digitalWrite(RELAY_PIN, LOW); // 假设LOW是断开继电器
|
||||
Serial.println("继电器断开 - 停止充电 (模拟)。");
|
||||
}
|
||||
Reference in New Issue
Block a user