Hello everyone, i am not new to the arduino world but i am fairly new to the web interfacing with the arduino.
I'm currently trying to renovate a really old project of my dad's that includes controlling several relays over the internet. He was doing it via remote desktop and an old PLC but we decided to make it prettier and smarter so i started incorporating it with arduino.
After many many mishaps and unfortunate events...i finally have a working entity which i designed on an arduino UNO + Ethernet shield. The problem is that the UNO has way less digital pins than what i need so i needed to move over to the Mega. This is where things get weird........
The point of the project is that there are 7 input pins that control the relays and 14 output pins that monitor the system. Those 14 outputs are being printed on the website using Ajax. Everything works fine on the UNO but when i move over to the Mega the 14 States are not printed at all...
The point of the project is that there are 7 input pins that control the relays
So you write to 7 inputs and
and 14 output pins that monitor the system.
read from 14 outputs. Very strange...
// send web page
webFile = SD.open("index.htm"); // open web page file
if (webFile) {
while(webFile.available()) {
client.write(webFile.read()); // send web page to client
}
webFile.close();
}
Sending the web page one character per packet is incredibly slow.
int dist;
digitalWrite(3, LOW); // Set the trigger pin to low for 2uS
delay(2);
digitalWrite(3, HIGH); // Send a 10uS high to trigger tRAnging
delay(10);
digitalWrite(3, LOW); // Send pin low again
dist = pulseIn(2, HIGH); // Read in times pulse
You should read what the return type from pulseIn() is, and store the value in the correct type variable.
What do your Serial.print()s tell you is happening?
oops i just realized what i was writing hehe... yes you are right 100% i got confused! Do you have any suggestions as to what the problem could be though ? I am testing as we speak and still haven't figured it out at all...