| <?xml version="1.0" encoding="UTF-8" standalone="no"?> | |||||
| <?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage"> | |||||
| <storageModule moduleId="org.eclipse.cdt.core.settings"> | |||||
| <cconfiguration id="io.sloeber.core.sketch.0"> | |||||
| <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="io.sloeber.core.sketch.0" moduleId="org.eclipse.cdt.core.settings" name="Release"> | |||||
| <externalSettings/> | |||||
| <extensions> | |||||
| <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> | |||||
| <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | |||||
| <extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | |||||
| <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | |||||
| </extensions> | |||||
| </storageModule> | |||||
| <storageModule moduleId="cdtBuildSystem" version="4.0.0"> | |||||
| <configuration artifactName="${ProjName}" buildProperties="" cleanCommand="rm -f" description="" id="io.sloeber.core.sketch.0" name="Release" parent="io.sloeber.core.configuration.release"> | |||||
| <folderInfo id="io.sloeber.core.sketch.0." name="/" resourcePath=""> | |||||
| <toolChain id="io.sloeber.core.toolChain.release.1203424416" name="Arduino Toolchain (Sloeber edition)" superClass="io.sloeber.core.toolChain.release"> | |||||
| <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="io.sloeber.targetplatform.1601321437" name="Arduino Target" osList="all" superClass="io.sloeber.targetplatform"/> | |||||
| <builder buildPath="${workspace_loc:/FSRemotePowerSwitch}/Release" id="io.sloeber.sketch.builder.1196383202" keepEnvironmentInBuildfile="false" name="Arduino sketch builder" parallelBuildOn="false" superClass="io.sloeber.sketch.builder"/> | |||||
| <tool id="io.sloeber.tool.sketch.compiler.cpp.1826714851" name="Arduino C++ Compiler" superClass="io.sloeber.tool.sketch.compiler.cpp"> | |||||
| <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="io.sloeber.compiler.cpp.sketch.option.incpath.1592749907" name="Include Paths (-I)" superClass="io.sloeber.compiler.cpp.sketch.option.incpath" valueType="includePath"> | |||||
| <listOptionValue builtIn="false" value=""${workspace_loc:/FSRemotePowerSwitch/core/core}""/> | |||||
| <listOptionValue builtIn="false" value=""${workspace_loc:/FSRemotePowerSwitch/core/variant}""/> | |||||
| <listOptionValue builtIn="false" value=""${workspace_loc:/FSRemotePowerSwitch/libraries/ArduinoJson/src}""/> | |||||
| <listOptionValue builtIn="false" value=""${workspace_loc:/FSRemotePowerSwitch/libraries/AccelStepper/src}""/> | |||||
| </option> | |||||
| <inputType id="io.sloeber.compiler.cpp.sketch.input.1774730493" name="CPP source files" superClass="io.sloeber.compiler.cpp.sketch.input"/> | |||||
| </tool> | |||||
| <tool id="io.sloeber.tool.compiler.c.1228564326" name="Arduino C Compiler" superClass="io.sloeber.tool.compiler.c"> | |||||
| <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="io.sloeber.compiler.c.sketch.option.incpath.1887998313" name="Include Paths (-I)" superClass="io.sloeber.compiler.c.sketch.option.incpath" valueType="includePath"> | |||||
| <listOptionValue builtIn="false" value=""${workspace_loc:/FSRemotePowerSwitch/core/core}""/> | |||||
| <listOptionValue builtIn="false" value=""${workspace_loc:/FSRemotePowerSwitch/core/variant}""/> | |||||
| <listOptionValue builtIn="false" value=""${workspace_loc:/FSRemotePowerSwitch/libraries/ArduinoJson/src}""/> | |||||
| <listOptionValue builtIn="false" value=""${workspace_loc:/FSRemotePowerSwitch/libraries/AccelStepper/src}""/> | |||||
| </option> | |||||
| <inputType id="io.sloeber.compiler.c.sketch.input.1528033502" name="C Source Files" superClass="io.sloeber.compiler.c.sketch.input"/> | |||||
| </tool> | |||||
| <tool id="io.sloeber.tool.sketch.compiler.s.579855230" name="Arduino Assembler" superClass="io.sloeber.tool.sketch.compiler.s"> | |||||
| <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="io.sloeber.compiler.asm.sketch.option.incpath.1692763518" name="Include Paths (-I)" superClass="io.sloeber.compiler.asm.sketch.option.incpath" valueType="includePath"> | |||||
| <listOptionValue builtIn="false" value=""${workspace_loc:/FSRemotePowerSwitch/core/core}""/> | |||||
| <listOptionValue builtIn="false" value=""${workspace_loc:/FSRemotePowerSwitch/core/variant}""/> | |||||
| <listOptionValue builtIn="false" value=""${workspace_loc:/FSRemotePowerSwitch/libraries/ArduinoJson/src}""/> | |||||
| <listOptionValue builtIn="false" value=""${workspace_loc:/FSRemotePowerSwitch/libraries/AccelStepper/src}""/> | |||||
| </option> | |||||
| <inputType id="io.sloeber.compiler.S.sketch.input.67304239" name="Assembly source files" superClass="io.sloeber.compiler.S.sketch.input"/> | |||||
| </tool> | |||||
| <tool id="io.sloeber.tool.ar.2137607011" name="Arduino archiver" superClass="io.sloeber.tool.ar"/> | |||||
| <tool id="io.sloeber.tool.combine.1817061304" name="Arduino combiner" superClass="io.sloeber.tool.combine"/> | |||||
| <tool id="io.sloeber.tool.objcopy.eep.1918189120" name="Arduino tool objcopy command" superClass="io.sloeber.tool.objcopy.eep"/> | |||||
| <tool id="io.sloeber.tool.size.1599481882" name="Arduino tool Print Size" superClass="io.sloeber.tool.size"/> | |||||
| </toolChain> | |||||
| </folderInfo> | |||||
| <folderInfo id="io.sloeber.core.sketch.0.libraries/**/._*" resourcePath="libraries/**/._*"> | |||||
| <toolChain id="io.sloeber.core.toolChain5.331292459" superClass="io.sloeber.core.toolChain5"> | |||||
| <targetPlatform id="io.sloeber.core.sketch.0.libraries/**/._*.1217115483" name=""/> | |||||
| </toolChain> | |||||
| </folderInfo> | |||||
| <folderInfo id="io.sloeber.core.sketch.0.libraries/?*/**/test*/**" resourcePath="libraries/?*/**/test*/**"> | |||||
| <toolChain id="io.sloeber.core.toolChain3.514991434" superClass="io.sloeber.core.toolChain3"> | |||||
| <targetPlatform id="io.sloeber.core.sketch.0.libraries/?*/**/test*/**.1259847971" name=""/> | |||||
| </toolChain> | |||||
| </folderInfo> | |||||
| <folderInfo id="io.sloeber.core.sketch.0.libraries/?*/**/?xtras/**" resourcePath="libraries/?*/**/?xtras/**"> | |||||
| <toolChain id="io.sloeber.core.toolChain2.2060562449" superClass="io.sloeber.core.toolChain2"> | |||||
| <targetPlatform id="io.sloeber.core.sketch.0.libraries/?*/**/?xtras/**.1662694404" name=""/> | |||||
| </toolChain> | |||||
| </folderInfo> | |||||
| <folderInfo id="io.sloeber.core.sketch.0.libraries/?*/**/?xamples/**" resourcePath="libraries/?*/**/?xamples/**"> | |||||
| <toolChain id="io.sloeber.core.toolChain1.128336890" superClass="io.sloeber.core.toolChain1"> | |||||
| <targetPlatform id="io.sloeber.core.sketch.0.libraries/?*/**/?xamples/**.91341827" name=""/> | |||||
| </toolChain> | |||||
| </folderInfo> | |||||
| <folderInfo id="io.sloeber.core.sketch.0.libraries/?*/**/third-party/**" resourcePath="libraries/?*/**/third-party/**"> | |||||
| <toolChain id="io.sloeber.core.toolChain4.1404350963" superClass="io.sloeber.core.toolChain4"> | |||||
| <targetPlatform id="io.sloeber.core.sketch.0.libraries/?*/**/third-party/**.1593271477" name=""/> | |||||
| </toolChain> | |||||
| </folderInfo> | |||||
| <folderInfo id="io.sloeber.core.sketch.0.libraries/?*/utility/*/*" resourcePath="libraries/?*/utility/*/*"> | |||||
| <toolChain id="io.sloeber.core.toolChain6.2111493700" superClass="io.sloeber.core.toolChain6"> | |||||
| <targetPlatform id="io.sloeber.core.sketch.0.libraries/?*/utility/*/*.1087276154" name=""/> | |||||
| </toolChain> | |||||
| </folderInfo> | |||||
| <sourceEntries> | |||||
| <entry excluding="libraries/?*/**/?xamples/**|libraries/?*/**/?xtras/**|libraries/?*/**/test*/**|libraries/?*/**/third-party/**|libraries/**/._*|libraries/?*/utility/*/*" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> | |||||
| </sourceEntries> | |||||
| </configuration> | |||||
| </storageModule> | |||||
| <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> | |||||
| </cconfiguration> | |||||
| </storageModule> | |||||
| <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/> | |||||
| <storageModule moduleId="cdtBuildSystem" version="4.0.0"> | |||||
| <project id="FSRemotePowerSwitch.io.sloeber.core.sketch.1960264148" name="Arduino sketch" projectType="io.sloeber.core.sketch"/> | |||||
| </storageModule> | |||||
| <storageModule moduleId="scannerConfiguration"> | |||||
| <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> | |||||
| </storageModule> | |||||
| <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/> | |||||
| <storageModule moduleId="refreshScope"/> | |||||
| </cproject> |
| /Release |
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <projectDescription> | |||||
| <name>FSRemotePowerSwitch</name> | |||||
| <comment></comment> | |||||
| <projects> | |||||
| </projects> | |||||
| <buildSpec> | |||||
| <buildCommand> | |||||
| <name>io.sloeber.core.inoToCpp</name> | |||||
| <arguments> | |||||
| </arguments> | |||||
| </buildCommand> | |||||
| <buildCommand> | |||||
| <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> | |||||
| <triggers>clean,full,incremental,</triggers> | |||||
| <arguments> | |||||
| </arguments> | |||||
| </buildCommand> | |||||
| <buildCommand> | |||||
| <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name> | |||||
| <triggers>full,incremental,</triggers> | |||||
| <arguments> | |||||
| </arguments> | |||||
| </buildCommand> | |||||
| </buildSpec> | |||||
| <natures> | |||||
| <nature>org.eclipse.cdt.core.cnature</nature> | |||||
| <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> | |||||
| <nature>org.eclipse.cdt.core.ccnature</nature> | |||||
| <nature>io.sloeber.arduinonature</nature> | |||||
| <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature> | |||||
| </natures> | |||||
| <linkedResources> | |||||
| <link> | |||||
| <name>core/core</name> | |||||
| <type>2</type> | |||||
| <locationURI>ECLIPSE_HOME/arduinoPlugin/packages/arduino/hardware/avr/1.8.4/cores/arduino</locationURI> | |||||
| </link> | |||||
| <link> | |||||
| <name>core/variant</name> | |||||
| <type>2</type> | |||||
| <locationURI>ECLIPSE_HOME/arduinoPlugin/packages/arduino/hardware/avr/1.8.4/variants/eightanaloginputs</locationURI> | |||||
| </link> | |||||
| <link> | |||||
| <name>libraries/AccelStepper</name> | |||||
| <type>2</type> | |||||
| <locationURI>ECLIPSE_HOME/arduinoPlugin/libraries/AccelStepper/1.61.0</locationURI> | |||||
| </link> | |||||
| <link> | |||||
| <name>libraries/ArduinoJson</name> | |||||
| <type>2</type> | |||||
| <locationURI>ECLIPSE_HOME/arduinoPlugin/libraries/ArduinoJson/7.0.2</locationURI> | |||||
| </link> | |||||
| </linkedResources> | |||||
| </projectDescription> |
| <?xml version="1.0" encoding="UTF-8" standalone="no"?> | |||||
| <project> | |||||
| <configuration id="io.sloeber.core.sketch.0" name="Release"> | |||||
| <extension point="org.eclipse.cdt.core.LanguageSettingsProvider"> | |||||
| <provider class="io.sloeber.core.toolchain.ArduinoLanguageProvider" console="false" env-hash="1759918841576165527" id="io.sloeber.languageSettingsProvider" keep-relative-paths="false" name="Arduino Compiler Settings" parameter="${COMMAND} -E -P -v -dD -D__IN_ECLIPSE__ "${INPUTS}"" prefer-non-shared="true"> | |||||
| <language-scope id="org.eclipse.cdt.core.gcc"/> | |||||
| <language-scope id="org.eclipse.cdt.core.g++"/> | |||||
| </provider> | |||||
| </extension> | |||||
| </configuration> | |||||
| </project> |
| Config.Release.board.BOARD.ID=nano | |||||
| Config.Release.board.BOARD.MENU.CpuFrequency=80 | |||||
| Config.Release.board.BOARD.MENU.DebugLevel=debug | |||||
| Config.Release.board.BOARD.MENU.FlashFreq=80 | |||||
| Config.Release.board.BOARD.MENU.FlashSize=4M1M | |||||
| Config.Release.board.BOARD.MENU.UploadSpeed=115200 | |||||
| Config.Release.board.BOARD.MENU.cpu=atmega328old | |||||
| Config.Release.board.BOARD.TXT=${SLOEBER_HOME}/arduinoPlugin/packages/arduino/hardware/avr/1.8.4/boards.txt | |||||
| Config.Release.board.PROGRAMMER.NAME=Default | |||||
| Config.Release.board.UPLOAD.PORT=COM3 | |||||
| Config.Release.compile.sloeber.extra.all= | |||||
| Config.Release.compile.sloeber.extra.archive= | |||||
| Config.Release.compile.sloeber.extra.assembly= | |||||
| Config.Release.compile.sloeber.extra.c.compile= | |||||
| Config.Release.compile.sloeber.extra.compile= | |||||
| Config.Release.compile.sloeber.extra.cpp.compile= | |||||
| Config.Release.compile.sloeber.extra.link= | |||||
| Config.Release.compile.sloeber.size.switch=false | |||||
| Config.Release.compile.sloeber.warning_level=NONE | |||||
| Config.Release.compile.sloeber.warning_level.custom= | |||||
| Config.Release.other.IS_VERSION_CONTROLLED=false |
| /* | |||||
| * FSRemotePowerSwitch | |||||
| * | |||||
| * Allows to control an Arduino to power up a device. | |||||
| * | |||||
| * A send over cmd from a PC will set a digital pin to high, which | |||||
| * switches relay to close a 230V AC circuit. | |||||
| * | |||||
| * | |||||
| */ | |||||
| #include "Arduino.h" | |||||
| #include <ArduinoJson.h> | |||||
| #include <AccelStepper.h> | |||||
| #include <HardwareSerial.h> | |||||
| #include <math.h> | |||||
| const char *Version = "V1.1.0"; | |||||
| const String CMD_SENDER_PC = "FSRemotePowerSwitch_PC"; | |||||
| const String CMD_SENDER_AN = "FSRemotePowerSwitch_AN"; | |||||
| const String CMD_VER = "Version"; | |||||
| const String CMD_STATUS_RELAY = "Status_Relay"; | |||||
| const String CMD_POWER_RELAY = "Power_Relay"; | |||||
| const String CMD_STATUS_CAM = "Status_Cam"; | |||||
| const String CMD_POWER_CAM = "Power_Cam"; | |||||
| const String CMD_AZIMUT_CAM = "Azimut_Cam"; | |||||
| const String CMD_ACT_AZIMUT_CAM = "Actual_Azimut_Cam"; | |||||
| const String CMD_ZERO_CAM = "Zero_Cam"; | |||||
| const String CMD_VELOCITY_CAM = "Velocity_Cam"; | |||||
| const String CMD_VAL_ON = "On"; | |||||
| const String CMD_VAL_OFF = "Off"; | |||||
| const String CMD_VELOCITY_SLOW = "Slow"; | |||||
| const String CMD_VELOCITY_FAST = "Fast"; | |||||
| const int PWR_RELAY_PIN = 5; | |||||
| const int PWR_CAM_PIN = 6; | |||||
| String stepperVelocity; | |||||
| JsonDocument msg; | |||||
| // Define motor interface type | |||||
| #define motorInterfaceType AccelStepper::MotorInterfaceType::HALF4WIRE | |||||
| // Creates an instance | |||||
| AccelStepper stepper(motorInterfaceType, 8, 10, 9, 11); | |||||
| // The setup function runs once when you press reset or power the board | |||||
| void setup() { | |||||
| Serial.begin(9600); | |||||
| pinMode(PWR_RELAY_PIN, OUTPUT); | |||||
| pinMode(PWR_CAM_PIN, OUTPUT); | |||||
| digitalWrite(PWR_RELAY_PIN, HIGH); | |||||
| digitalWrite(PWR_CAM_PIN, HIGH); | |||||
| setSlowStepperVelocity(); // Slow: Acc: 500 / Fast: MaxSpeed: 1000 | |||||
| // Slow: Acc: 200 / Fast: MaxSpeed: 500 | |||||
| } | |||||
| /* The loop function runs over and and checks the serial port for receiving a Json of following format: | |||||
| * | |||||
| * JSON for FSRemotePowerSwitch | |||||
| * | |||||
| * { | |||||
| * "sender": "FSRemotePowerSwitch_PC" or "FSRemotePowerSwitch_AN", | |||||
| * "cmd": "Version" or "Status_Relay" or "Power_Relay" or "Status_Cam" or "Power_Cam" or "Azimut_Cam" or "Zero_Cam", | |||||
| * "val": "V0.0.1" or "On"/"Off" or "0" | |||||
| * } | |||||
| * | |||||
| */ | |||||
| void loop() { | |||||
| if (Serial.available() > 0) { | |||||
| moveStepper(); | |||||
| String message = readSerialData(); | |||||
| // Deserialize the JSON document | |||||
| DeserializationError error = deserializeJson(msg, message); | |||||
| // Test if parsing succeeds. | |||||
| if (error) { | |||||
| Serial.print(F("deserializeJson() failed: ")); | |||||
| Serial.print(message); | |||||
| Serial.println(error.f_str()); | |||||
| return; | |||||
| } | |||||
| message = ""; | |||||
| String sdr = msg["Sender"]; | |||||
| String cmd = msg["Cmd"]; | |||||
| String val = msg["Val"]; | |||||
| if (sdr == CMD_SENDER_PC && cmd == CMD_VER) { | |||||
| sendVersion(); | |||||
| } else if (sdr == CMD_SENDER_PC && cmd == CMD_POWER_RELAY) { | |||||
| if (val == CMD_VAL_ON) { | |||||
| digitalWrite(PWR_RELAY_PIN, LOW); | |||||
| } else if (val == CMD_VAL_OFF) { | |||||
| digitalWrite(PWR_RELAY_PIN, HIGH); | |||||
| } | |||||
| if (digitalRead(PWR_RELAY_PIN) == LOW) { | |||||
| moveStepper(); | |||||
| sendRelayPowerStatus(CMD_VAL_ON); | |||||
| } else { | |||||
| moveStepper(); | |||||
| sendRelayPowerStatus(CMD_VAL_OFF); | |||||
| } | |||||
| } else if (sdr == CMD_SENDER_PC && cmd == CMD_STATUS_RELAY) { | |||||
| if (digitalRead(PWR_RELAY_PIN) == LOW) { | |||||
| moveStepper(); | |||||
| sendRelayPowerStatus(CMD_VAL_ON); | |||||
| } else { | |||||
| moveStepper(); | |||||
| sendRelayPowerStatus(CMD_VAL_OFF); | |||||
| } | |||||
| } else if (sdr == CMD_SENDER_PC && cmd == CMD_POWER_CAM) { | |||||
| if (val == CMD_VAL_ON) { | |||||
| digitalWrite(PWR_CAM_PIN, HIGH); | |||||
| stepper.move(10); | |||||
| moveStepper(); | |||||
| } else if (val == CMD_VAL_OFF) { | |||||
| moveStepper(); | |||||
| digitalWrite(PWR_CAM_PIN, LOW); | |||||
| } | |||||
| if (digitalRead(PWR_CAM_PIN) == HIGH) { | |||||
| moveStepper(); | |||||
| sendCamPowerStatus(CMD_VAL_ON); | |||||
| } else { | |||||
| moveStepper(); | |||||
| sendCamPowerStatus(CMD_VAL_OFF); | |||||
| } | |||||
| } else if (sdr == CMD_SENDER_PC && cmd == CMD_STATUS_CAM) { | |||||
| if (digitalRead(PWR_CAM_PIN) == HIGH) { | |||||
| moveStepper(); | |||||
| sendCamPowerStatus(CMD_VAL_ON); | |||||
| } else { | |||||
| moveStepper(); | |||||
| sendCamPowerStatus(CMD_VAL_OFF); | |||||
| } | |||||
| } else if (sdr == CMD_SENDER_PC && cmd == CMD_ZERO_CAM) { | |||||
| stepper.setCurrentPosition(0); | |||||
| sendZeroCamStatus(String(stepper.currentPosition())); | |||||
| } else if (sdr == CMD_SENDER_PC && cmd == CMD_VELOCITY_CAM) { | |||||
| if (val.equals(CMD_VELOCITY_FAST)) { | |||||
| setFastStepperVelocity(); | |||||
| } else if (val.equals(CMD_VELOCITY_SLOW)) { | |||||
| setSlowStepperVelocity(); | |||||
| } | |||||
| sendCamVelocityStatus(); | |||||
| } else if (sdr == CMD_SENDER_PC && cmd == CMD_ACT_AZIMUT_CAM) { | |||||
| int actAzi = round(stepper.currentPosition() / (4076.0 / 360.0) * -1); | |||||
| sendCamActAzimut(String(actAzi)); | |||||
| } else if (sdr == CMD_SENDER_PC && cmd == CMD_AZIMUT_CAM) { | |||||
| if (digitalRead(PWR_CAM_PIN) == HIGH) { | |||||
| long target = round((4076.0 / 360.0) * val.toDouble() * -1); | |||||
| stepper.moveTo(target); | |||||
| stepper.run(); | |||||
| } | |||||
| } | |||||
| } | |||||
| moveStepper(); | |||||
| } | |||||
| void moveStepper() { | |||||
| if (stepper.distanceToGo() != 0) { | |||||
| // Move the motor one step | |||||
| stepper.run(); | |||||
| } | |||||
| } | |||||
| String readSerialData() { | |||||
| String msg = ""; | |||||
| String data = ""; | |||||
| while (Serial.available() > 0) { | |||||
| data = Serial.readString(); | |||||
| msg += data; | |||||
| //delay(50); | |||||
| } | |||||
| return msg; | |||||
| } | |||||
| void setFastStepperVelocity() { | |||||
| stepperVelocity = CMD_VELOCITY_FAST; | |||||
| stepper.setCurrentPosition(stepper.currentPosition()); | |||||
| stepper.setMaxSpeed(1000); // Slow: 500 / Fast: 1000 | |||||
| stepper.setAcceleration(500); // Slow: 200 / Fast: 500 | |||||
| stepper.setSpeed(1000); | |||||
| } | |||||
| void setSlowStepperVelocity() { | |||||
| stepperVelocity = CMD_VELOCITY_SLOW; | |||||
| stepper.setCurrentPosition(stepper.currentPosition()); | |||||
| stepper.setMaxSpeed(500); // Slow: 500 / Fast: 1000 | |||||
| stepper.setAcceleration(200); // Slow: 200 / Fast: 500 | |||||
| stepper.setSpeed(500); | |||||
| } | |||||
| void sendVersion() { | |||||
| msg["Sender"] = CMD_SENDER_AN; | |||||
| msg["Cmd"] = CMD_VER; | |||||
| msg["Val"] = Version; | |||||
| serializeJson(msg, Serial); | |||||
| } | |||||
| void sendRelayPowerStatus(String status) { | |||||
| msg["Sender"] = CMD_SENDER_AN; | |||||
| msg["Cmd"] = CMD_STATUS_RELAY; | |||||
| msg["Val"] = status; | |||||
| serializeJson(msg, Serial); | |||||
| } | |||||
| void sendCamPowerStatus(String status) { | |||||
| msg["Sender"] = CMD_SENDER_AN; | |||||
| msg["Cmd"] = CMD_STATUS_CAM; | |||||
| msg["Val"] = status; | |||||
| serializeJson(msg, Serial); | |||||
| } | |||||
| void sendZeroCamStatus(String val) { | |||||
| msg["Sender"] = CMD_SENDER_AN; | |||||
| msg["Cmd"] = CMD_ZERO_CAM; | |||||
| msg["Val"] = val; | |||||
| serializeJson(msg, Serial); | |||||
| } | |||||
| void sendCamActAzimut(String val) { | |||||
| msg["Sender"] = CMD_SENDER_AN; | |||||
| msg["Cmd"] = CMD_ACT_AZIMUT_CAM; | |||||
| msg["Val"] = val; | |||||
| serializeJson(msg, Serial); | |||||
| } | |||||
| void sendCamVelocityStatus() { | |||||
| msg["Sender"] = CMD_SENDER_AN; | |||||
| msg["Cmd"] = CMD_VELOCITY_CAM; | |||||
| msg["Val"] = stepperVelocity; | |||||
| serializeJson(msg, Serial); | |||||
| } |
| #ifdef __IN_ECLIPSE__ | |||||
| //This is a automatic generated file | |||||
| //Please do not modify this file | |||||
| //If you touch this file your change will be overwritten during the next build | |||||
| //This file has been generated on 2024-02-12 21:37:17 | |||||
| #include "Arduino.h" | |||||
| #include "Arduino.h" | |||||
| #include <ArduinoJson.h> | |||||
| #include <AccelStepper.h> | |||||
| #include <HardwareSerial.h> | |||||
| #include <math.h> | |||||
| void setup() ; | |||||
| void loop() ; | |||||
| void moveStepper() ; | |||||
| String readSerialData() ; | |||||
| void setFastStepperVelocity() ; | |||||
| void setSlowStepperVelocity() ; | |||||
| void sendVersion() ; | |||||
| void sendRelayPowerStatus(String status) ; | |||||
| void sendCamPowerStatus(String status) ; | |||||
| void sendZeroCamStatus(String val) ; | |||||
| void sendCamActAzimut(String val) ; | |||||
| void sendCamVelocityStatus() ; | |||||
| #include "FSRemotePowerSwitch.ino" | |||||
| #endif |
| spec.o: \ | |||||
| Z:/Privat/Diverses/Arduino/Sketches/SloeberWS/.metadata/.plugins/org.eclipse.cdt.managedbuilder.core/spec.cpp |