Will the library compile with Uno selected ? I'm not sure about the Serial1, Serial2, Serial3.
Yes, Serial1, Serial2 and Serial3 are only available when an Arduino MEGA2560 is selected:
#if defined(__AVR_ATmega2560__)
switch (SerialAddress) {
case 0:
Serial.begin(BaudRate);
SerialID=0;
break;
case 1:
Serial1.begin(BaudRate);
SerialID=1;
break;
case 2:
Serial2.begin(BaudRate);
SerialID=2;
break;
case 3:
Serial3.begin(BaudRate);
SerialID=3;
break;
default:
Serial.begin(BaudRate);
SerialID=0;
break;
}
#else
Serial.begin(2400);
SerialID=0;
#endif
For all other boards Serial.begin is used.
Why not call the function "On", instead of Relais_ON ?
If the class would be called "Relay", it would be called with Relay.Relay_ON().
Well, that just didn't occur to me I'll change that in a next version. => DONE
You could follow the digitalWrite(pin,HIGH/LOW) function, and use a parameter for On and Off: set( relay, HIGH=on/LOW=off)
Good idea... => added Set function
Most Arduino functions use "begin()", instead of "Initialize()".
hmmm, that is true. Init or initialize is something I usually use, but for standarisation begin would be more intuative. => DONE
Why did you use real 'tabs' ? I thought that the Arduino IDE uses spaces as tabs.
tabs, I love tabs I use VisualMicro in VisualStudio 2010 to do both my Arduino coding as other programming languages. I'm used to use tabs.. Guilty as charged
Why did you use a switch() statement in RS232Instruction().
Would this do it: Relay = RelaisNr + '0';
I never realized or tried if that would work. I'll give it a shot
What is the "switch (SerialID)" doing ? Every case is the same code.
No it is not If SerialID is set to 3 => Serial3.write etc.. Was the easiest way I could think of to be able to use multiple Serial ports on my MEGA
I also moved the CardAddress from begin to the seperate functions because up to 255 cards could be connected.