From ba35bd7c9d3f3d29113c1b81dcab0e96ca5dc847 Mon Sep 17 00:00:00 2001 From: Alexander Richter Date: Tue, 15 Aug 2023 13:15:57 +0200 Subject: [PATCH] decided to have some predefinded pins at startup --- LinuxCNC_ArduinoConnector.ino | 20 ++++++++++---------- arduino-connector.py | 12 ++++++------ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/LinuxCNC_ArduinoConnector.ino b/LinuxCNC_ArduinoConnector.ino index 6c3a876..7bf3f14 100644 --- a/LinuxCNC_ArduinoConnector.ino +++ b/LinuxCNC_ArduinoConnector.ino @@ -64,23 +64,23 @@ Communication Status = 'E' -read/Write -Pin State: 0:0 //###################################################IO's################################################### -//#define INPUTS //Use Arduino IO's as Inputs. Define how many Inputs you want in total and then which Pins you want to be Inputs. +#define INPUTS //Use Arduino IO's as Inputs. Define how many Inputs you want in total and then which Pins you want to be Inputs. #ifdef INPUTS - const int Inputs = 5; //number of inputs using internal Pullup resistor. (short to ground to trigger) - int InPinmap[] = {52,38,39,40,41}; + const int Inputs = 2; //number of inputs using internal Pullup resistor. (short to ground to trigger) + int InPinmap[] = {8,9}; #endif //Use Arduino IO's as Toggle Inputs, which means Inputs (Buttons for example) keep HIGH State after Release and Send LOW only after beeing Pressed again. -//#define SINPUTS //Define how many Toggle Inputs you want in total and then which Pins you want to be Toggle Inputs. +#define SINPUTS //Define how many Toggle Inputs you want in total and then which Pins you want to be Toggle Inputs. #ifdef SINPUTS - const int sInputs = 5; //number of inputs using internal Pullup resistor. (short to ground to trigger) - int sInPinmap[] = {32,33,34,35,36}; + const int sInputs = 1; //number of inputs using internal Pullup resistor. (short to ground to trigger) + int sInPinmap[] = {10}; #endif -//#define OUTPUTS //Use Arduino IO's as Outputs. Define how many Outputs you want in total and then which Pins you want to be Outputs. +#define OUTPUTS //Use Arduino IO's as Outputs. Define how many Outputs you want in total and then which Pins you want to be Outputs. #ifdef OUTPUTS - const int Outputs = 9; //number of outputs - int OutPinmap[] = {10,9,8,7,6,5,4,3,2,21}; + const int Outputs = 2; //number of outputs + int OutPinmap[] = {11,12}; #endif //#define PWMOUTPUTS //Use Arduino PWM Capable IO's as PWM Outputs. Define how many PWM Outputs you want in total and then which Pins you want to be PWM Outputs. @@ -192,7 +192,7 @@ const float scalingFactor = 0.01; // Scaling factor to control the impact of d // Define an Pin you want to connect the LED to. it will be set as Output indipendand of the OUTPUTS function, so don't use Pins twice. // If you use Digital LED's such as WS2812 or PL9823 (only works if you set up the DLED settings below) you can also define a position of the LED. In this case StatLedPin will set the number of the Digital LED Chain. -//#define STATUSLED +#define STATUSLED #ifdef STATUSLED const int StatLedPin = 13; //Pin for Status LED const int StatLedErrDel[] = {1000,10}; //Blink Timing for Status LED Error (no connection) diff --git a/arduino-connector.py b/arduino-connector.py index 9b55979..42662ab 100644 --- a/arduino-connector.py +++ b/arduino-connector.py @@ -54,17 +54,17 @@ connection = '/dev/ttyACM0' #this is the port your Arduino is connected to. You # Set how many Inputs you have programmed in Arduino and which pins are Inputs, Set Inputs = 0 to disable -Inputs = 0 -InPinmap = [37,38,39,40,41] #Which Pins are Inputs? +Inputs = 2 +InPinmap = [8,9] #Which Pins are Inputs? # Set how many Toggled ("sticky") Inputs you have programmed in Arduino and which pins are Toggled Inputs , Set SInputs = 0 to disable -SInputs = 0 -sInPinmap = [32,33,34,35,36] #Which Pins are SInputs? +SInputs = 1 +sInPinmap = [10] #Which Pins are SInputs? # Set how many Outputs you have programmed in Arduino and which pins are Outputs, Set Outputs = 0 to disable -Outputs = 0 #9 Outputs, Set Outputs = 0 to disable -OutPinmap = [10,9,8,7,6,5,4,3,2,21] #Which Pins are Outputs? +Outputs = 2 #9 Outputs, Set Outputs = 0 to disable +OutPinmap = [11,12] #Which Pins are Outputs? # Set how many PWM Outputs you have programmed in Arduino and which pins are PWM Outputs, you can set as many as your Arduino has PWM pins. List the connected pins below. PwmOutputs = 0 #number of PwmOutputs, Set PwmOutputs = 0 to disable