RGB Controller Codes and Circuits
This commit is contained in:
@@ -52,16 +52,12 @@ long last_position_saved = 0;
|
||||
long last_Position_Checked = 0;
|
||||
|
||||
int motor_direction = 0;
|
||||
int last_motor_move_direction = 0;
|
||||
long motor_position_counter = 0;
|
||||
|
||||
int goingTo = int_max;
|
||||
|
||||
|
||||
int timeZone = 3;
|
||||
|
||||
|
||||
|
||||
bool isReverse = false;
|
||||
|
||||
struct Position {
|
||||
@@ -74,8 +70,6 @@ struct Position {
|
||||
int numPositions = 0;
|
||||
Position positionList[10];
|
||||
|
||||
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
|
||||
@@ -111,8 +105,6 @@ void loop() {
|
||||
}
|
||||
}
|
||||
|
||||
if (motor_direction != 0) last_motor_move_direction = motor_direction;
|
||||
|
||||
digitalWrite(left_Motor_forward_pin, motor_direction > 0 ? HIGH : LOW);
|
||||
digitalWrite(right_Motor_forward_pin, motor_direction > 0 ? HIGH : LOW);
|
||||
|
||||
@@ -191,12 +183,6 @@ void saveMotorPosition() {
|
||||
f.close();
|
||||
}
|
||||
|
||||
f = SPIFFS.open("/last_motor_move_direction.log", "w");
|
||||
if (f) {
|
||||
f.println(last_motor_move_direction);
|
||||
f.close();
|
||||
}
|
||||
|
||||
last_position_saved = millis();
|
||||
}
|
||||
|
||||
@@ -207,12 +193,6 @@ void loadLastValues() {
|
||||
f.close();
|
||||
}
|
||||
|
||||
f = SPIFFS.open("/last_motor_move_direction.log", "r");
|
||||
if (f) {
|
||||
last_motor_move_direction = f.readStringUntil('\n').toInt();
|
||||
f.close();
|
||||
}
|
||||
|
||||
f = SPIFFS.open("/reverse.log", "r");
|
||||
if (f) {
|
||||
isReverse = f.readStringUntil('\n').toInt() == 1;
|
||||
@@ -249,9 +229,6 @@ void loadLastValues() {
|
||||
|
||||
void go(int p) {
|
||||
goingTo = p;
|
||||
|
||||
//if (motor_position_counter < goingTo && last_motor_move_direction == -1) motor_position_counter -= 2;
|
||||
//else if (motor_position_counter > goingTo && last_motor_move_direction == 1) motor_position_counter += 2;
|
||||
}
|
||||
|
||||
void read_encoder() {
|
||||
|
||||
Reference in New Issue
Block a user