Im new here, from time to time im working with arduino but im not a expert.
IM have one homework to doo:
On one side (A) i need to read statement (NO or NC) send information about 3 statements through LAN.
On other side (B) i need relay card that is controled by arduino with ethernet shield.
When 1.st intup is active on A side, on other side B relay need to be activated.
Sory for my bad english.
Can someone help me with my school homework please.
Here is a part that read a statements and colect them into the variable int.
Next i need idea how to send variables int (thre of them) to LAN?
//Homework for por student that have angry fat crazy teacher that hate him
//26.05.16.
//Device on A side that receive thre statements and send them in LAN
//declare thre input pins
#define const int inputPin1 = A1;
#define const int inputPin2 = A2;
#define const int inputPin3 = A3;
//declare variable for three inputs
int varInput1 = 0;
int lastvarInput1 = 1;
int varInput2 = 0;
int lastvarInput2 = 1;
int varInput3 = 0;
int lastvarInput3 =1;
long lastDebounceTime = 0;
long debounceDelay = 50;
void setup() {
// put your setup code here, to run once:
pinMode(inputPin1, INPUT);
digitalWrite(inputPin1,HIGH); //enable pull up resistors
pinMode(inputPin2, INPUT);
digitalWrite(inputPin2,HIGH); //enable pull up resistors
pinMode(inputPin3, INPUT);
digitalWrite(inputPin3,HIGH); //enable pull up resistors
}
void loop() {
// put your main code here, to run repeatedly:
int reading = digitalRead(inputPin1);digitalRead(inputPin2);digitalRead(inputPin3);
if (reading != lastvarInput1,lastvarInput2,lastvarInput3){
lastDebounceTime = millis();
}
if ((millis() - lastDebounceTime) > debounceDelay) {
if (reading != varInput1,varInput2,varInput3) {
varInput1,varInput2,varInput3 = reading;
//here i need a code to transmit my int. varInput1,varInput2,varInput3
}
}
}
lastvarInput1 = reading;
lastvarInput2 = reading;
lastvarInput3 = reading;
}
This is device on B side that need to receive thre int statements and activate relays.
//Homework for por student that have angry fat crazy teacher that hate him
//26.05.16.
//Device on B side that receive int through LAN and activate Relays
//declare thre output pins
#define const int outPin1 = 1;
#define const int outPin2 = 2;
#define const int outPin3 = 3;
//declare variable for three outputs
int varOut1 = 0;
int varOut2 = 0;
int varOut3 = 0;
void setup() {
// put your setup code here, to run once:
pinMode(outPin1, OUTPUT);
pinMode(outPin2, OUTPUT);
pinMode(outPin3, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
int reading = //reading tre int varInput1, varInput2, varInput3 from device A;
if (reading != varOut1,varOut2,varOut3) { //if readed variables is diferent from last state
varOut1,varOut2,varOut3 = reading; //give variables curent reading status
}
digitalWrite (outPin1, varOut1);
digitalWrite (outPin2, varOut2);
digitalWrite (outPin3, varOut3);
}
I actually love my professors but sometimes can be too tiring and asks his students too . Suppose my case never worked transmit information over the network, and find us to a very difficult task , saying it will affect the final evaluation at the end of the school year. None of my friends do not know how to solve this task , and I'm afraid to ask for help from the teacher.
I think i have begining (read statements and conver them to useful data int.)
and i have end (use transmited information from network and check curent state and activate relays)
please help me with midle part (transmit thre integers over network)
i srched google to find some similar task but i cannot find them.