gituser пре 1 година
родитељ
комит
d03170f640
2 измењених фајлова са 5 додато и 8 уклоњено
  1. 4
    7
      FSRemotePowerSwitch.ino
  2. 1
    1
      sloeber.ino.cpp

+ 4
- 7
FSRemotePowerSwitch.ino Прегледај датотеку



JsonDocument msg; JsonDocument msg;
String stepperVelocity; String stepperVelocity;
int actAzi = 0;


// Define motor interface type // Define motor interface type
#define motorInterfaceType AccelStepper::MotorInterfaceType::HALF4WIRE #define motorInterfaceType AccelStepper::MotorInterfaceType::HALF4WIRE
pinMode(PWR_RELAY_PIN, OUTPUT); pinMode(PWR_RELAY_PIN, OUTPUT);
pinMode(PWR_CAM_PIN, OUTPUT); pinMode(PWR_CAM_PIN, OUTPUT);


digitalWrite(PWR_RELAY_PIN, HIGH);
digitalWrite(PWR_CAM_PIN, HIGH);

setSlowStepperVelocity(); // Slow: Acc: 500 / Fast: MaxSpeed: 1000 setSlowStepperVelocity(); // Slow: Acc: 500 / Fast: MaxSpeed: 1000
// Slow: Acc: 200 / Fast: MaxSpeed: 500 // Slow: Acc: 200 / Fast: MaxSpeed: 500

digitalWrite(PWR_RELAY_PIN, HIGH);
digitalWrite(PWR_CAM_PIN, HIGH);
} }


/* The loop function runs over and and checks the serial port for receiving a Json of following format: /* The loop function runs over and and checks the serial port for receiving a Json of following format:


} else if (sdr == CMD_SENDER_PC && cmd == CMD_ZERO_CAM) { } else if (sdr == CMD_SENDER_PC && cmd == CMD_ZERO_CAM) {
stepper.setCurrentPosition(0); stepper.setCurrentPosition(0);
actAzi = 0;
sendZeroCamStatus(String(stepper.currentPosition())); sendZeroCamStatus(String(stepper.currentPosition()));


} else if (sdr == CMD_SENDER_PC && cmd == CMD_VELOCITY_CAM) { } else if (sdr == CMD_SENDER_PC && cmd == CMD_VELOCITY_CAM) {
sendCamVelocityStatus(); sendCamVelocityStatus();


} else if (sdr == CMD_SENDER_PC && cmd == CMD_ACT_AZIMUT_CAM) { } else if (sdr == CMD_SENDER_PC && cmd == CMD_ACT_AZIMUT_CAM) {
actAzi = round(stepper.currentPosition() / (4076.0 / 360.0) * -1);
int actAzi = round(stepper.currentPosition() / (4076.0 / 360.0) * -1);
sendCamActAzimut(String(actAzi)); sendCamActAzimut(String(actAzi));


} else if (sdr == CMD_SENDER_PC && cmd == CMD_AZIMUT_CAM) { } else if (sdr == CMD_SENDER_PC && cmd == CMD_AZIMUT_CAM) {
if (digitalRead(PWR_CAM_PIN) == LOW) { if (digitalRead(PWR_CAM_PIN) == LOW) {
actAzi = val.toInt();
long target = round((4076.0 / 360.0) * val.toDouble() * -1); long target = round((4076.0 / 360.0) * val.toDouble() * -1);
stepper.moveTo(target); stepper.moveTo(target);
stepper.run(); stepper.run();

+ 1
- 1
sloeber.ino.cpp Прегледај датотеку

//This is a automatic generated file //This is a automatic generated file
//Please do not modify this file //Please do not modify this file
//If you touch this file your change will be overwritten during the next build //If you touch this file your change will be overwritten during the next build
//This file has been generated on 2025-01-22 18:08:22
//This file has been generated on 2025-01-22 22:57:08


#include "Arduino.h" #include "Arduino.h"
#include "Arduino.h" #include "Arduino.h"

Loading…
Откажи
Сачувај