I am using an Arduino R3 and an Ethernet Shield 2. The I/O pins are not connected. The Shield is connected to the same Ethernet switch as are my computers. I only need local area access. I have run existing DCHP programs, and I see the shield on my router by looking at "Attached Devices". So, I know the hardware is working. But when I use a fixed IP I do not see the Ethernet shield at all. I am either using wrong instructions, missing instructions, or putting the instructions in the incorrect portion of the sketch. Any help would be appreciated.
Chuck
Just assign the shield a static IP address using the DHCP configuration tool in your router.
That being said ....
Imagine for a moment that we can't see your code. Now, ask yourself how can you possibly imagine that you could get any help with it under those conditions?
Oh wait .... we CAN'T see your code.
Remember subnet mask and gateway are used by the Arduino to route whatever path you’re using on the LAN
Here is the entire sketch. This should help get help. Obviously my approach was incorrect.
//band comparator 8/2023
//this sketch designed to use an Arduino UNO R3 and an Ethernet shield
//SPECIFICATIONS
//if both radios are on the same band, inhibit both transmitters and sound the alarm
//if one radio is on a WARC band inhibit the opposite radio as the radio on the WARC band has no bandpass protection. Turn on
//yellow LED to indicate which radio is using a WARC band.
//V3 corrects an adjacent band issue when using the WARC bands. Bands adjacent to the WARC band are bandpass filter protected. HOWEVER,
//the 3 pole filters are not sharp enough. Therefore, the radio on the WARC band can damage the other radio if the other radio is on
//a band adjacent to the WARC band in use. For example, if transmitting on 12m while the other radio is on 10m or 15m could damage
//the other radio. Therefore, when using a WARC band you will be prohibited from transmitting if the other radio is on a band adjacent
//to the WARC band. Adjacent band was NOT considered in version 2 of this sketch.
//an Ethernet shield is being used even though an UNO R4 has wireless as I prefer wired technology in an RF environment
//The Ethernet shield uses pin4, and pins 10 thru 13. Setting pin 4 high inhibits the SD Card reader on the shield
//non-Arduino Ethernet Shields may use an additional pin as a shield reset. Not good for this design as all I/O pins are used.
//radio 1 BCD will go to pins 2,3,5,6
//radio 2 BCD will go to pins 7,8,A4,A5
//Alarm uses pin A0 and will flash and produce audio with only power being supplied to device.
//Radio 1 inhibit uses pin A1, and Radio 2 inhibit uses pin a2 These inhibit signals will trip relays that will in turn inhibit transmitting
//on the specific radio(s).
//Yellow LED for Radio 1 uses pin A3 and Yellow LED for Radio 2 uses pin 9.
//Yellow LED's Initially designed to indicate which radio is on a WARC band
// radio #1 digital pins array
//physical pin numbers. Functionally D1-D4
// Pin 2=D1="A", pin 3=D2="B", pin 5=D3="C", Pin 6=D4="D" of a BCD output from Radio 1 where "A" is the LSB
//
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = {0xA8, 0x61, 0x0A, 0xAE, 0xF2, 0xA7}; //defines variable mac as the specific mac address for the Ethernet shield
EthernetServer server(1180); //ethernet port 80
IPAddress ip(192,168,1,201);
int SDSelect = 4;
int r1Pins[] = { 2, 3, 5, 6 };// pin 4 used by Ethernet shield for SD card which is not used by this sketch
// radio #2 digital pins array
//physical pin numbers. Functionally D5-D8
// Pin 7=D1="A", pin 8=D2="B", pin A4="C", Pin A5=D4="D" of a BCD output from Radio 2 where "A" is the LSB
// 2=A, 3=B, 4-C, 5=D
int r2Pins[] = { 7, 8, A4, A5 };// pin 9 & up are used by Ethernet shield
// pin states for each radio's band ID
int r1[] = { 0, 0, 0, 0 };
int r2[] = { 0, 0, 0, 0 };
// flasing LED pin
int pLED = A0;//alarm led is on pin A0
// LED flash frequency //flashing occurs in hardware not software
//float ledFreq = 5; // Hz
//float ledMilli = floor(1000/(2*ledFreq));
// radio #1 and #2 inhibit relays
int pInh1 = A1;
int pInh2 = A2;
int WarcR1 = A3;
int WarcR2 = 9;
//when a radio if off all BCD outputs are high
//if a radio is on a warc band the other radio needs to be off.
// create band nmemonic IDs to make code more readable
// for example, the code below sets the value of the memory variable "b160m" to the number 1
// The binary code for 160m is defined as decimal 1. The binary codde for 6 meters is decimal 10.
const int off = 0; //when radio is off the binary code is 0
const int b160m = 1;
const int b80m = 2;
const int b40m = 3;
const int b30m = 4;
const int b20m = 5;
const int b17m = 6;
const int b15m = 7;
const int b12m = 8;
const int b10m = 9;
const int b6m = 10;
const int aux = 15;
char *Radio1[] = {"Radio 1"};
char *Radio2[] = {"Radio 2"};
char *Status[] = {"Status"};
char *Band[] = {"Off","160m","80m","40m","30m","20m","17m","15m","12m","10m","6m"};
void setup()
{
//open serial communications and wait for port to open
Serial.begin(9600);
while (!Serial)
{
; // wait for serial port to connect
}
//turn off SD card reader (Part of Ethernet shield) as it could interfere with Ethernet operation
pinMode(SDSelect,OUTPUT);
digitalWrite(SDSelect,HIGH);
//start ethernet connection and the server
Ethernet.begin(mac,ip);
server.begin();
Serial.println(Ethernet.localIP());
//delay(5000);
//Serial.print ("Server is at ");
// set up input pin functionality using internal pullup resistors
// pull up resistors are usually a real good idea. currently unknown if level converters already take care of this requirement
for (int i = 0; i < 4; i++) {
//the next 2 lines are for reference ONLY. If pullup resistors are ever needed for an input use the syntax shown in the next 2 lines
//pinMode(r1Pins[i], INPUT_PULLUP);
//pinMode(r2Pins[i], INPUT_PULLUP);
// define inputs without a pull_up resistor
pinMode(r1Pins[i], INPUT);
pinMode(r2Pins[i], INPUT);
}
// set up output pin functionality
pinMode(pLED, OUTPUT);
pinMode(pInh1, OUTPUT);
pinMode(pInh2, OUTPUT);
pinMode(WarcR1, OUTPUT);
pinMode(WarcR2, OUTPUT);
digitalWrite(WarcR1,HIGH); // Set radio 1 amber LED off
digitalWrite(WarcR2,HIGH); // Set radio 2 amber LED off
}
//the "void loop" statements will repeat over and over again
void loop()
{
// set up radio band IDs which will contain the decimal value of the BCD band code
//clear variables each pass thru the loop
//the next few lines are intended to affect memory variables NOT the action taken
int r1Band = 0; //r1Band is an interger and is set to 0
int r2Band = 0; //r2Band is an interger and is set to 0
//"bool" defines the stated variable as boolian and will define the condition as true or false
bool bandMatch = false; //clear not on same band
bool bandWarcR1 = false; // clear radio 1 not on a WARC band
bool bandWarcR2 = false; // clear radio 2 not on a WARC band
bool bLedOn = false; //turn led off
bool adjBandR1 = false;
bool adjBandR2 = false;
// powers of two setup (initially 2^zero)
// BCD data "A" is 2 to the zeroth power, "B" is 2 squared, "C" is 3 Qubed and D is 2 to the fourth power
// This allows for the value of the four lines to be translated into a decimal value
int twoPowMult = 1;
// read radio #1 and radio #2 band IDs and encode band IDs.
//each loop bandMatch will be defined by ???????
//each loop bandWarcR1 and bandwarcR2 is defined by
for (int i = 0; i < 4; i++)
{
// encode as sum of 2^i * pinValue
r1Band += twoPowMult * (digitalRead(r1Pins[i])); //band that radio 1 is on after processing 4 times
r2Band += twoPowMult * (digitalRead(r2Pins[i])); //band that radio 2 is on after processing 4 times
twoPowMult *= 2;//twoPowMult was 1 initial pass now will be 1 times 2 or 2 for i=2, 2 times 2 for pass3 and 4 times 2 for pass 3
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Rule #1 - determine exact band match for bands 160m thru 6m
// reminder that "=" means you set the value to whatever is to the right of the "="
// A "==" testing if it is equal.
// We are looking for a true or False (Bool value). If, in fact, r1Band=r2Band there is a conflict
// If not the first test is proven false and we need to check bands adjacent (adj) to the WARC band frequency
// Need to see any radio is on a WARC band the other radio will have its transmitter inhibited
// the next if statment is checking to see if both radios are on the same band. This includes ALL bands including WARC bands
if (r1Band == r2Band) //testing shows that bandmatch=1 when it should be a 0 (False)
bandMatch=true; //both radios are on the same band (160m-6m)
else
bandMatch=false;//radios not on same band
//check for band match on both radios; if so the variable bandmatch is true
//if both radios have BCD of "off" or Aux" there is no band match
// the symbol "||" means "or" and the symbol "&&" meand "and"
if ((r1Band == off || r1Band == aux) && (r2Band == off || r2Band == aux))
bandMatch = false; //no bandmatch
bandWarcR1=false;
bandWarcR2=false;
//the symbol "||" means "or"
if (r1Band==b30m || r1Band==b17m || r1Band==b12m) //if any warc band is in use on radio 1 set bandWarcR1 to true
bandWarcR1=true;
if (r2Band==b30m || r2Band==b17m || r2Band==b12m) //if any warc band is in use on radio 2 set bandWarcR1 to true
bandWarcR2=true;
if (r1Band==off && r2Band==off) //if both radios are off bandWarcR1 and bandWarcR2 must be false
{
bandWarcR1=false;
bandWarcR2=false;
}
//if radio 1 is on a warc band and radio 2 is on a band adjacent to that warc band set adjBandR2 to TRUE
if ((r1Band==b12m && (r2Band==b10m || r2Band==b15m)) || (r1Band==b17m && (r2Band==b15m || r2Band==b20m)) || (r1Band==b30m && (r2Band==b20m || r2Band==b40m)))
adjBandR2=true;
else
adjBandR2=false;
if ((r2Band==b12m && (r1Band==b10m || r1Band==b15m)) || (r2Band==b17m && (r1Band==b15m || r1Band==b20m)) || (r2Band==b30m && (r1Band==b20m || r1Band==b40m)))
adjBandR1=true;
else
adjBandR1=false;
//when either adjBandR1 or adjBandR2 are true both radios transmitters need to be inhibited. The radio on the WARC band needs protection
//from radio 2 transmitting and overdriving radio 1's unprotected input. Also, Radio 2 is at risk on an adjacent band because the 3 pole
//bandpass filter on the adjacent band is not narrow enough to effectively block the nearby WARC band.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//the statements above set memory varibles. The following statments will
//take action on results of those set variables
//work with results of the tests performed above
// band violation occurs if either rule is violated then bandWarc will be true
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//process WARC band information
if (adjBandR2)//if this is true radio 1 is on a WARC band and Radio 2 is on an adjacent band
{
digitalWrite(pInh1, LOW);
digitalWrite(pInh2, LOW);
digitalWrite(WarcR1,LOW); //Radio 1 on WARC band amber LED on
digitalWrite(WarcR2,HIGH); //Radio 2 NOT on WARC band amber LED on
Radio1[1] = "Radio 1 is on a WARC Band";
Radio2[1] = "Radio 2 is on band adjacent to in-use WARC Band";
Status[1] = "Status: CONFLICT Both Transmitters Inhibited";
Serial.println ("TEST1");
}
else
{
if (adjBandR1)//if this is true radio 2 is on a WARC band and Radio 1 is on an adjacent band
{
digitalWrite(pInh1, LOW);
digitalWrite(pInh2, LOW);
digitalWrite(WarcR2,LOW); //Radio 2 on WARC band amber LED on
digitalWrite(WarcR1,HIGH); //Radio 1 NOT on WARC band amber LED off
Radio1[1] = "Radio 1 is on band adjacent to in-use WARC Band";
Radio2[1] = "Radio 2 is on a WARC band";
Status[1] = "Status: CONFLICT Both Transmitters Inhibited";
Serial.println ("TEST2");
}
else
//if here there is no WARC band adjacent band conflicts
{
if ((bandWarcR1) && !(bandWarcR2)) //testing to see if radio 1 is on a WARC band
//inhibit radio 2 transmit and set amber LED for radio 1
{
digitalWrite(pInh1, HIGH); //radio 2 NOT on WARC Band
digitalWrite(pInh2, LOW); //inhibit radio 2 becasue radio 1 is on a WARC band
digitalWrite(WarcR1,LOW); //Radio 1 on WARC band amber LED on
digitalWrite(WarcR2,HIGH); //Radio 2 NOT on WARC band. Turn off amber LED on
Radio1[1] = "Radio 1 is on a WARC band";
Radio2[1] = "Radio 2 is on non-adjacent band";
Status[1] = "Status: Radio 2 Transmit inhibited";
Serial.println ("TEST3");
}
else
{
if ((bandWarcR2) && !(bandWarcR1)) //testing to see if radio 2 is on a WARC band
{
digitalWrite(pInh1, LOW); //radio 1 NOT on WARC Band
digitalWrite(pInh2, HIGH); //inhibit radio 1 becasue radio 2 is on a WARC band
digitalWrite(WarcR1,HIGH); //Radio 1 NOT on WARC band amber LED off
digitalWrite(WarcR2,LOW); //Radio 2 on WARC band. Turn off amber LED on
Radio1[1] = "Radio 1 is on an unconflicting band";
Radio2[1] = "Radio 2 is on a WARC band";
Status[1] = "Status: Radio 1 Transmit inhibited";
Serial.println ("TEST4");
}
else
{
if ((bandWarcR1) && (bandWarcR2)) //testing to see if radio 1 & radio 2 is on a WARC band
{
digitalWrite(pInh1, LOW); //inhibit radio 2 because radio 2 is on a WARC band
digitalWrite(pInh2, LOW); //inhibit radio 1 because radio 2 is on a WARC band
digitalWrite(WarcR1,LOW); //Radio 1 on WARC band amber LED on
digitalWrite(WarcR2,LOW); //Radio 2 on WARC band amber LED on
Radio1[1] = "Radio 1 is on a WARC band";
Radio2[1] = "Radio 2 is on a WARC band";
Status[1] = "Status: CONFLICT. Both Radios Inhibited";
Serial.println ("TEST5");
}
else
{
digitalWrite(pInh1, HIGH); //no WARC Band
digitalWrite(pInh2, HIGH); //no WARC Band
digitalWrite(WarcR1,HIGH); //no WARC Band
digitalWrite(WarcR2,HIGH); //no WARC Band
Radio1[1] = "Radio 1 operational";
Radio2[1] = "Radio 2 operational";
Status[1] = "Status: GOOD";
Serial.println ("TEST6");
}
}
}
}
}
//end of WARC Band Processing
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//sound alarm if on the same band regardless if a WARC band or not. Same band sets off alarm
if (bandMatch)
{
// inhibit transmit on both radios. digital write sets the pin specified
digitalWrite(pInh1, LOW);
digitalWrite(pInh2, LOW);
bLedOn = true; //set variable to activate conflict alert signal
Radio1[1] = "Radio 1 on same band as Radio 2";
Radio2[1] = "Radio 2 on same band as Radio 1";
Status[1] = "Status: Conflict. Transmit inhibited both radios";
}
else
bLedOn = false;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (bLedOn) //if memory variable is true
// turn LED on
digitalWrite(pLED, LOW);//turn alarm on
else
digitalWrite(pLED, HIGH);//turn alarm off No alarm condition exists
//Finished processing Alarm sound and Alarm LED
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Write to Arduino Serial Printer
Serial.print("Radio 1 on "),Serial.print(Band[r1Band]),Serial.print("--Radio 2 on "),Serial.println(Band[r2Band]);
Serial.println(Radio1[1]);
Serial.println(Radio2[1]);
Serial.println(Status[1]);
Serial.println ("");
delay(1500);
}//end loop. go back to start of loop
Your approach to posting code is obviously incorrect. Read below then re-post your code using Code Tags. Beside, I already gave you the solution in Post #2.
Here is the code using tags. Sorry for prior post. Hope this works. Reserving an ip address in my router and running a sample ethernet sketch did not result in using the reserved IP.
//band comparator 8/2023
//this sketch designed to use an Arduino UNO R3 and an Ethernet shield
//SPECIFICATIONS
//if both radios are on the same band, inhibit both transmitters and sound the alarm
//if one radio is on a WARC band inhibit the opposite radio as the radio on the WARC band has no bandpass protection. Turn on
//yellow LED to indicate which radio is using a WARC band.
//V3 corrects an adjacent band issue when using the WARC bands. Bands adjacent to the WARC band are bandpass filter protected. HOWEVER,
//the 3 pole filters are not sharp enough. Therefore, the radio on the WARC band can damage the other radio if the other radio is on
//a band adjacent to the WARC band in use. For example, if transmitting on 12m while the other radio is on 10m or 15m could damage
//the other radio. Therefore, when using a WARC band you will be prohibited from transmitting if the other radio is on a band adjacent
//to the WARC band. Adjacent band was NOT considered in version 2 of this sketch.
//an Ethernet shield is being used even though an UNO R4 has wireless as I prefer wired technology in an RF environment
//The Ethernet shield uses pin4, and pins 10 thru 13. Setting pin 4 high inhibits the SD Card reader on the shield
//non-Arduino Ethernet Shields may use an additional pin as a shield reset. Not good for this design as all I/O pins are used.
//radio 1 BCD will go to pins 2,3,5,6
//radio 2 BCD will go to pins 7,8,A4,A5
//Alarm uses pin A0 and will flash and produce audio with only power being supplied to device.
//Radio 1 inhibit uses pin A1, and Radio 2 inhibit uses pin a2 These inhibit signals will trip relays that will in turn inhibit transmitting
//on the specific radio(s).
//Yellow LED for Radio 1 uses pin A3 and Yellow LED for Radio 2 uses pin 9.
//Yellow LED's Initially designed to indicate which radio is on a WARC band
// radio #1 digital pins array
//physical pin numbers. Functionally D1-D4
// Pin 2=D1="A", pin 3=D2="B", pin 5=D3="C", Pin 6=D4="D" of a BCD output from Radio 1 where "A" is the LSB
//
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = {0xA8, 0x61, 0x0A, 0xAE, 0xF2, 0xA7}; //defines variable mac as the specific mac address for the Ethernet shield
EthernetServer server(1180); //ethernet port 80
IPAddress ip(192,168,1,201);
int SDSelect = 4;
int r1Pins[] = { 2, 3, 5, 6 };// pin 4 used by Ethernet shield for SD card which is not used by this sketch
// radio #2 digital pins array
//physical pin numbers. Functionally D5-D8
// Pin 7=D1="A", pin 8=D2="B", pin A4="C", Pin A5=D4="D" of a BCD output from Radio 2 where "A" is the LSB
// 2=A, 3=B, 4-C, 5=D
int r2Pins[] = { 7, 8, A4, A5 };// pin 9 & up are used by Ethernet shield
// pin states for each radio's band ID
int r1[] = { 0, 0, 0, 0 };
int r2[] = { 0, 0, 0, 0 };
// flasing LED pin
int pLED = A0;//alarm led is on pin A0
// LED flash frequency //flashing occurs in hardware not software
//float ledFreq = 5; // Hz
//float ledMilli = floor(1000/(2*ledFreq));
// radio #1 and #2 inhibit relays
int pInh1 = A1;
int pInh2 = A2;
int WarcR1 = A3;
int WarcR2 = 9;
//when a radio if off all BCD outputs are high
//if a radio is on a warc band the other radio needs to be off.
// create band nmemonic IDs to make code more readable
// for example, the code below sets the value of the memory variable "b160m" to the number 1
// The binary code for 160m is defined as decimal 1. The binary codde for 6 meters is decimal 10.
const int off = 0; //when radio is off the binary code is 0
const int b160m = 1;
const int b80m = 2;
const int b40m = 3;
const int b30m = 4;
const int b20m = 5;
const int b17m = 6;
const int b15m = 7;
const int b12m = 8;
const int b10m = 9;
const int b6m = 10;
const int aux = 15;
char *Radio1[] = {"Radio 1"};
char *Radio2[] = {"Radio 2"};
char *Status[] = {"Status"};
char *Band[] = {"Off","160m","80m","40m","30m","20m","17m","15m","12m","10m","6m"};
void setup()
{
//open serial communications and wait for port to open
Serial.begin(9600);
while (!Serial)
{
; // wait for serial port to connect
}
//turn off SD card reader (Part of Ethernet shield) as it could interfere with Ethernet operation
pinMode(SDSelect,OUTPUT);
digitalWrite(SDSelect,HIGH);
//start ethernet connection and the server
Ethernet.begin(mac,ip);
server.begin();
Serial.println(Ethernet.localIP());
//delay(5000);
//Serial.print ("Server is at ");
// set up input pin functionality using internal pullup resistors
// pull up resistors are usually a real good idea. currently unknown if level converters already take care of this requirement
for (int i = 0; i < 4; i++) {
//the next 2 lines are for reference ONLY. If pullup resistors are ever needed for an input use the syntax shown in the next 2 lines
//pinMode(r1Pins[i], INPUT_PULLUP);
//pinMode(r2Pins[i], INPUT_PULLUP);
// define inputs without a pull_up resistor
pinMode(r1Pins[i], INPUT);
pinMode(r2Pins[i], INPUT);
}
// set up output pin functionality
pinMode(pLED, OUTPUT);
pinMode(pInh1, OUTPUT);
pinMode(pInh2, OUTPUT);
pinMode(WarcR1, OUTPUT);
pinMode(WarcR2, OUTPUT);
digitalWrite(WarcR1,HIGH); // Set radio 1 amber LED off
digitalWrite(WarcR2,HIGH); // Set radio 2 amber LED off
}
//the "void loop" statements will repeat over and over again
void loop()
{
// set up radio band IDs which will contain the decimal value of the BCD band code
//clear variables each pass thru the loop
//the next few lines are intended to affect memory variables NOT the action taken
int r1Band = 0; //r1Band is an interger and is set to 0
int r2Band = 0; //r2Band is an interger and is set to 0
//"bool" defines the stated variable as boolian and will define the condition as true or false
bool bandMatch = false; //clear not on same band
bool bandWarcR1 = false; // clear radio 1 not on a WARC band
bool bandWarcR2 = false; // clear radio 2 not on a WARC band
bool bLedOn = false; //turn led off
bool adjBandR1 = false;
bool adjBandR2 = false;
// powers of two setup (initially 2^zero)
// BCD data "A" is 2 to the zeroth power, "B" is 2 squared, "C" is 3 Qubed and D is 2 to the fourth power
// This allows for the value of the four lines to be translated into a decimal value
int twoPowMult = 1;
// read radio #1 and radio #2 band IDs and encode band IDs.
//each loop bandMatch will be defined by ???????
//each loop bandWarcR1 and bandwarcR2 is defined by
for (int i = 0; i < 4; i++)
{
// encode as sum of 2^i * pinValue
r1Band += twoPowMult * (digitalRead(r1Pins[i])); //band that radio 1 is on after processing 4 times
r2Band += twoPowMult * (digitalRead(r2Pins[i])); //band that radio 2 is on after processing 4 times
twoPowMult *= 2;//twoPowMult was 1 initial pass now will be 1 times 2 or 2 for i=2, 2 times 2 for pass3 and 4 times 2 for pass 3
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Rule #1 - determine exact band match for bands 160m thru 6m
// reminder that "=" means you set the value to whatever is to the right of the "="
// A "==" testing if it is equal.
// We are looking for a true or False (Bool value). If, in fact, r1Band=r2Band there is a conflict
// If not the first test is proven false and we need to check bands adjacent (adj) to the WARC band frequency
// Need to see any radio is on a WARC band the other radio will have its transmitter inhibited
// the next if statment is checking to see if both radios are on the same band. This includes ALL bands including WARC bands
if (r1Band == r2Band) //testing shows that bandmatch=1 when it should be a 0 (False)
bandMatch=true; //both radios are on the same band (160m-6m)
else
bandMatch=false;//radios not on same band
//check for band match on both radios; if so the variable bandmatch is true
//if both radios have BCD of "off" or Aux" there is no band match
// the symbol "||" means "or" and the symbol "&&" meand "and"
if ((r1Band == off || r1Band == aux) && (r2Band == off || r2Band == aux))
bandMatch = false; //no bandmatch
bandWarcR1=false;
bandWarcR2=false;
//the symbol "||" means "or"
if (r1Band==b30m || r1Band==b17m || r1Band==b12m) //if any warc band is in use on radio 1 set bandWarcR1 to true
bandWarcR1=true;
if (r2Band==b30m || r2Band==b17m || r2Band==b12m) //if any warc band is in use on radio 2 set bandWarcR1 to true
bandWarcR2=true;
if (r1Band==off && r2Band==off) //if both radios are off bandWarcR1 and bandWarcR2 must be false
{
bandWarcR1=false;
bandWarcR2=false;
}
//if radio 1 is on a warc band and radio 2 is on a band adjacent to that warc band set adjBandR2 to TRUE
if ((r1Band==b12m && (r2Band==b10m || r2Band==b15m)) || (r1Band==b17m && (r2Band==b15m || r2Band==b20m)) || (r1Band==b30m && (r2Band==b20m || r2Band==b40m)))
adjBandR2=true;
else
adjBandR2=false;
if ((r2Band==b12m && (r1Band==b10m || r1Band==b15m)) || (r2Band==b17m && (r1Band==b15m || r1Band==b20m)) || (r2Band==b30m && (r1Band==b20m || r1Band==b40m)))
adjBandR1=true;
else
adjBandR1=false;
//when either adjBandR1 or adjBandR2 are true both radios transmitters need to be inhibited. The radio on the WARC band needs protection
//from radio 2 transmitting and overdriving radio 1's unprotected input. Also, Radio 2 is at risk on an adjacent band because the 3 pole
//bandpass filter on the adjacent band is not narrow enough to effectively block the nearby WARC band.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//the statements above set memory varibles. The following statments will
//take action on results of those set variables
//work with results of the tests performed above
// band violation occurs if either rule is violated then bandWarc will be true
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//process WARC band information
if (adjBandR2)//if this is true radio 1 is on a WARC band and Radio 2 is on an adjacent band
{
digitalWrite(pInh1, LOW);
digitalWrite(pInh2, LOW);
digitalWrite(WarcR1,LOW); //Radio 1 on WARC band amber LED on
digitalWrite(WarcR2,HIGH); //Radio 2 NOT on WARC band amber LED on
Radio1[1] = "Radio 1 is on a WARC Band";
Radio2[1] = "Radio 2 is on band adjacent to in-use WARC Band";
Status[1] = "Status: CONFLICT Both Transmitters Inhibited";
Serial.println ("TEST1");
}
else
{
if (adjBandR1)//if this is true radio 2 is on a WARC band and Radio 1 is on an adjacent band
{
digitalWrite(pInh1, LOW);
digitalWrite(pInh2, LOW);
digitalWrite(WarcR2,LOW); //Radio 2 on WARC band amber LED on
digitalWrite(WarcR1,HIGH); //Radio 1 NOT on WARC band amber LED off
Radio1[1] = "Radio 1 is on band adjacent to in-use WARC Band";
Radio2[1] = "Radio 2 is on a WARC band";
Status[1] = "Status: CONFLICT Both Transmitters Inhibited";
Serial.println ("TEST2");
}
else
//if here there is no WARC band adjacent band conflicts
{
if ((bandWarcR1) && !(bandWarcR2)) //testing to see if radio 1 is on a WARC band
//inhibit radio 2 transmit and set amber LED for radio 1
{
digitalWrite(pInh1, HIGH); //radio 2 NOT on WARC Band
digitalWrite(pInh2, LOW); //inhibit radio 2 becasue radio 1 is on a WARC band
digitalWrite(WarcR1,LOW); //Radio 1 on WARC band amber LED on
digitalWrite(WarcR2,HIGH); //Radio 2 NOT on WARC band. Turn off amber LED on
Radio1[1] = "Radio 1 is on a WARC band";
Radio2[1] = "Radio 2 is on non-adjacent band";
Status[1] = "Status: Radio 2 Transmit inhibited";
Serial.println ("TEST3");
}
else
{
if ((bandWarcR2) && !(bandWarcR1)) //testing to see if radio 2 is on a WARC band
{
digitalWrite(pInh1, LOW); //radio 1 NOT on WARC Band
digitalWrite(pInh2, HIGH); //inhibit radio 1 becasue radio 2 is on a WARC band
digitalWrite(WarcR1,HIGH); //Radio 1 NOT on WARC band amber LED off
digitalWrite(WarcR2,LOW); //Radio 2 on WARC band. Turn off amber LED on
Radio1[1] = "Radio 1 is on an unconflicting band";
Radio2[1] = "Radio 2 is on a WARC band";
Status[1] = "Status: Radio 1 Transmit inhibited";
Serial.println ("TEST4");
}
else
{
if ((bandWarcR1) && (bandWarcR2)) //testing to see if radio 1 & radio 2 is on a WARC band
{
digitalWrite(pInh1, LOW); //inhibit radio 2 because radio 2 is on a WARC band
digitalWrite(pInh2, LOW); //inhibit radio 1 because radio 2 is on a WARC band
digitalWrite(WarcR1,LOW); //Radio 1 on WARC band amber LED on
digitalWrite(WarcR2,LOW); //Radio 2 on WARC band amber LED on
Radio1[1] = "Radio 1 is on a WARC band";
Radio2[1] = "Radio 2 is on a WARC band";
Status[1] = "Status: CONFLICT. Both Radios Inhibited";
Serial.println ("TEST5");
}
else
{
digitalWrite(pInh1, HIGH); //no WARC Band
digitalWrite(pInh2, HIGH); //no WARC Band
digitalWrite(WarcR1,HIGH); //no WARC Band
digitalWrite(WarcR2,HIGH); //no WARC Band
Radio1[1] = "Radio 1 operational";
Radio2[1] = "Radio 2 operational";
Status[1] = "Status: GOOD";
Serial.println ("TEST6");
}
}
}
}
}
//end of WARC Band Processing
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//sound alarm if on the same band regardless if a WARC band or not. Same band sets off alarm
if (bandMatch)
{
// inhibit transmit on both radios. digital write sets the pin specified
digitalWrite(pInh1, LOW);
digitalWrite(pInh2, LOW);
bLedOn = true; //set variable to activate conflict alert signal
Radio1[1] = "Radio 1 on same band as Radio 2";
Radio2[1] = "Radio 2 on same band as Radio 1";
Status[1] = "Status: Conflict. Transmit inhibited both radios";
}
else
bLedOn = false;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (bLedOn) //if memory variable is true
// turn LED on
digitalWrite(pLED, LOW);//turn alarm on
else
digitalWrite(pLED, HIGH);//turn alarm off No alarm condition exists
//Finished processing Alarm sound and Alarm LED
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Write to Arduino Serial Printer
Serial.print("Radio 1 on "),Serial.print(Band[r1Band]),Serial.print("--Radio 2 on "),Serial.println(Band[r2Band]);
Serial.println(Radio1[1]);
Serial.println(Radio2[1]);
Serial.println(Status[1]);
Serial.println ("");
delay(1500);
}//end loop. go back to start of loop
Found why reserved IP address was not used. Programmed MAC address was different that reserved MAC address. Set to matching addresses and the reserved IP address was used and is fixed. This was on the sample sketch. Now to incorporate it in the sketch I wrote.
I made a lot of novice progress. I correctly uploaded the sketch in the correct format. I am currently using DHCP, the correct MAC address in my sketch and I can see the connection on my router list using the reserved information. However, when I try to access that IP address from a local computer I get "Err_Refused_to_Connect". So not only can I not connect I have no idea if I am sending information across the network.
What do you get when you "ping" the IP address from a PC?
I can ping the internal address of 192.168.1.80. Roundtrip time is 0MS. When entering that address into my browser I get "ERR_CONNECTION_REFUSED".
I don't see anywhere in your code that you do anything with the EthernetServer object that you instantiate. It supposed to do anything?
Since I am a novice, I plead total ignorance with "EthernetServer server(1180)". I probably got that from some other sketch and thought it was needed without understanding what that instruction is all about and what additional stuff I needed to do. I guess I wasn't too worried about it until I could connect to the shield. What I want the sketch to do is be able to view the serial printer information when I connect to the Ethernet Shield via the local network.
This forum has a sketch titled "Serial.print to Internet, Instead of Serial Monitor". That is exactly what I want to do and more in line with my needs than the supplied examples. However, this sketch is for a Mega 2560 R3. I cannot say I understand the code but my questions is, "Is the code for the Mega 2560 compatible with the Uno R3"? If so I'll start studying the sketch, get it working, and modify to apply to my sketch. The sketch, as is, uses pin 4 as an example. I believe that is the SD card enable for the UNO so i'd use a different pin to check out this sketch. Do you think this is a worthy pursuit?
Where is it? Please provide a link.
If you think that will meet your needs, by all means study it. Once you understand how it works, it shouldn't be difficult to adapt to your hardware. The Uno has a similar architecture to the Mega, just with fewer resources.
The title matches my needs! Sounds like it is worth the study. Thank you.
Chuck
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
