eerste
This commit is contained in:
parent
12365d373e
commit
9a88317df6
@ -69,17 +69,17 @@ Communication Status = 'E' -read/Write -Pin State: 0:0
|
||||
#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 = 2; //number of inputs using internal Pullup resistor. (short to ground to trigger)
|
||||
int InPinmap[] = {8,9};
|
||||
int InPinmap[] = { 21, 22 };
|
||||
#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 = 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 = 2; //number of outputs
|
||||
int OutPinmap[] = { 11, 12 };
|
||||
@ -224,7 +224,7 @@ If you want the LED to be off just define {0,0,0}, .
|
||||
If you use STATUSLED, it will also take the colors of your definition here.
|
||||
*/
|
||||
|
||||
//#define DLED
|
||||
#define DLED
|
||||
#ifdef DLED
|
||||
#include <Adafruit_NeoPixel.h>
|
||||
|
||||
@ -625,16 +625,14 @@ void comalive(){
|
||||
connectionState = 2;
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
connectionState = 1;
|
||||
#ifdef STATUSLED
|
||||
if (DLEDSTATUSLED == 1) {
|
||||
#ifdef DLED
|
||||
controlDLED(StatLedPin, 1);
|
||||
#endif
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
digitalWrite(StatLedPin, HIGH);
|
||||
}
|
||||
#endif
|
||||
@ -697,8 +695,6 @@ void reconnect(){
|
||||
#endif
|
||||
|
||||
connectionState = 1;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -722,22 +718,23 @@ void StatLedErr(int offtime, int ontime){
|
||||
if (newMillis - oldmillis >= offtime) {
|
||||
#ifdef DLED
|
||||
if (DLEDSTATUSLED == 1) {
|
||||
controlDLED(StatLedPin, 1);}
|
||||
controlDLED(StatLedPin, 1);
|
||||
}
|
||||
#endif
|
||||
if (DLEDSTATUSLED == 0) { digitalWrite(StatLedPin, HIGH); }
|
||||
}
|
||||
if (newMillis - oldmillis >= offtime+ontime){{
|
||||
if (newMillis - oldmillis >= offtime + ontime) {
|
||||
{
|
||||
#ifdef DLED
|
||||
if (DLEDSTATUSLED == 1) {
|
||||
controlDLED(StatLedPin, 0);}
|
||||
controlDLED(StatLedPin, 0);
|
||||
}
|
||||
#endif
|
||||
if (DLEDSTATUSLED == 0) { digitalWrite(StatLedPin, LOW); }
|
||||
|
||||
oldmillis = newMillis;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -779,8 +776,7 @@ void controlDLED(int Pin, int Stat){
|
||||
Serial.println(Stat);
|
||||
|
||||
#endif
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
|
||||
strip.setPixelColor(Pin, strip.Color(DledOffColors[Pin][0], DledOffColors[Pin][1], DledOffColors[Pin][2]));
|
||||
#ifdef DEBUG
|
||||
@ -818,8 +814,7 @@ void readAInputs(){
|
||||
|
||||
if (samplecount < smooth) {
|
||||
sumAinput[i] = sumAinput[i] + analogRead(AInPinmap[i]);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
sumAinput[i] = sumAinput[i] / smooth;
|
||||
if (oldAinput[i] != sumAinput[i]) {
|
||||
oldAinput[i] = sumAinput[i];
|
||||
@ -829,9 +824,11 @@ void readAInputs(){
|
||||
}
|
||||
}
|
||||
|
||||
if(samplecount < smooth){ samplecount = samplecount + 1;}
|
||||
else {samplecount = 0;}
|
||||
|
||||
if (samplecount < smooth) {
|
||||
samplecount = samplecount + 1;
|
||||
} else {
|
||||
samplecount = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef INPUTS
|
||||
@ -860,8 +857,7 @@ void readsInputs(){
|
||||
|
||||
if (togglesinputs[i]) {
|
||||
sendData('I', sInPinmap[i], togglesinputs[i]); // Turn the LED on
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
sendData('I', sInPinmap[i], togglesinputs[i]); // Turn the LED off
|
||||
}
|
||||
}
|
||||
@ -913,7 +909,6 @@ void readKeypad(){
|
||||
sendData('M', keys[row][col], 1);
|
||||
lastKey = keys[row][col];
|
||||
row = numRows;
|
||||
|
||||
}
|
||||
if (digitalRead(rowPins[row]) == HIGH && lastKey == keys[row][col]) {
|
||||
// The Last Button has been unpressed
|
||||
@ -926,7 +921,6 @@ void readKeypad(){
|
||||
// Set the column pin back to input mode
|
||||
pinMode(colPins[col], INPUT);
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -982,14 +976,12 @@ void commandReceived(char cmd, uint16_t io, uint16_t value){
|
||||
if (cmd == 'O') {
|
||||
writeOutputs(io, value);
|
||||
lastcom = millis();
|
||||
|
||||
}
|
||||
#endif
|
||||
#ifdef PWMOUTPUTS
|
||||
if (cmd == 'P') {
|
||||
writePwmOutputs(io, value);
|
||||
lastcom = millis();
|
||||
|
||||
}
|
||||
#endif
|
||||
#ifdef DLED
|
||||
@ -1002,7 +994,6 @@ void commandReceived(char cmd, uint16_t io, uint16_t value){
|
||||
Serial.print(" State:");
|
||||
Serial.println(DLEDstate[io]);
|
||||
#endif
|
||||
|
||||
}
|
||||
#endif
|
||||
#ifdef MULTIPLEXLEDS
|
||||
@ -1015,7 +1006,6 @@ void commandReceived(char cmd, uint16_t io, uint16_t value){
|
||||
Serial.print("Set to:");
|
||||
Serial.println(ledStates[io]);
|
||||
#endif
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1057,8 +1047,7 @@ void readCommands(){
|
||||
state = STATE_VALUE;
|
||||
bufferIndex = 0;
|
||||
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
Serial.print("Ungültiges zeichen: ");
|
||||
Serial.println(current);
|
||||
@ -1068,22 +1057,18 @@ void readCommands(){
|
||||
case STATE_VALUE:
|
||||
if (isDigit(current)) {
|
||||
inputbuffer[bufferIndex++] = current;
|
||||
}
|
||||
else if(current == '\n'){
|
||||
} else if (current == '\n') {
|
||||
inputbuffer[bufferIndex] = 0;
|
||||
value = atoi(inputbuffer);
|
||||
commandReceived(cmd, io, value);
|
||||
state = STATE_CMD;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
Serial.print("Ungültiges zeichen: ");
|
||||
Serial.println(current);
|
||||
#endif
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user