I'm new to networking and have only recently connecting and communicated with an Arduino UNO using the Ethernet Shield II. I did this using the latest version (1.8.42.0) of the Arduino IDE. However, when I tried to do the same thing using the required version IDE V1.6.8 I could not get it to work. Please excuse my rookie questions, but here goes. 1) Do I need to have my Ethernet Shield II and Arduino already communicating on my network before setting the board up with the plugin, or will this functionality be configured by the plugin? 2) When I had things working with V1.8.42.0 IDE I set it up using the IP, MAC and told it to use port 5000. If the plugin will configure the board for me, how do I know which port to use?
FYI - This is the program I currently have uploaded to the Arduino (usingV1.6.8):
const int garageLDR = A0; //connect garage LDR to pin A0
const int atticLDR = A1; //connect attic LDR to pin A1
const int garageStatusPin = 4; //pin to hold garage status
const int atticStatusPin = 5; //pin to hold attic status
int gLDR = 0; //Variable to hold garage LDR value
int aLDR = 0; //Variable to hold attic LDR value
int count = 0; //index for loop
int timer = 100; //delay for loop readings
void setup() {
Serial.begin(9600);
pinMode(garageStatusPin, OUTPUT); // 0 = garage dark, 1 = garage light
pinMode(atticStatusPin, OUTPUT); // 0 = attic dark, 1 = attic light
}
void loop() {
aLDR = 0; //initialize value
gLDR = 0; //initialize value
for (count=0;count<5;count++) {
gLDR = gLDR + analogRead(garageLDR); //read the photoresistor value
aLDR = aLDR + analogRead(atticLDR); //read the photoresistor value
delay(timer);
}
gLDR = gLDR/5; //take the average for five readings
aLDR = aLDR/5;
if (gLDR>450) {
digitalWrite(garageStatusPin, HIGH);
}
else {
digitalWrite(garageStatusPin, LOW);
}
if (aLDR>500) {
digitalWrite(atticStatusPin, HIGH);
}
else {
digitalWrite(atticStatusPin, LOW);
}
Serial.print("The garage LDR = ");
Serial.println(gLDR);
Serial.print("The attic LDR = ");
Serial.println(aLDR);
Serial.println('\n');
delay(1000);
}
FYI - This is the program I currently have uploaded to the Arduino (usingV1.6.8):
const int garageLDR = A0; //connect garage LDR to pin A0
const int atticLDR = A1; //connect attic LDR to pin A1
const int garageStatusPin = 4; //pin to hold garage status
const int atticStatusPin = 5; //pin to hold attic status
int gLDR = 0; //Variable to hold garage LDR value
int aLDR = 0; //Variable to hold attic LDR value
int count = 0; //index for loop
int timer = 100; //delay for loop readings
void setup() {
Serial.begin(9600);
pinMode(garageStatusPin, OUTPUT); // 0 = garage dark, 1 = garage light
pinMode(atticStatusPin, OUTPUT); // 0 = attic dark, 1 = attic light
}
void loop() {
aLDR = 0; //initialize value
gLDR = 0; //initialize value
for (count=0;count<5;count++) {
gLDR = gLDR + analogRead(garageLDR); //read the photoresistor value
aLDR = aLDR + analogRead(atticLDR); //read the photoresistor value
delay(timer);
}
gLDR = gLDR/5; //take the average for five readings
aLDR = aLDR/5;
if (gLDR>450) {
digitalWrite(garageStatusPin, HIGH);
}
else {
digitalWrite(garageStatusPin, LOW);
}
if (aLDR>500) {
digitalWrite(atticStatusPin, HIGH);
}
else {
digitalWrite(atticStatusPin, LOW);
}
Serial.print("The garage LDR = ");
Serial.println(gLDR);
Serial.print("The attic LDR = ");
Serial.println(aLDR);
Serial.println('\n');
delay(1000);
}
Comment