Hello guys!
My name is Victor, I am a c/c++ programmer (just hobbyist for the moment), and I'm new to Arduino.
First I want to say that I have a deep respect and gratitude,for all the people that brought their contribution to Arduino,with function libraries,different codes,or just gave an advice on the forum.
You are great,and I thank you very much, cause you made from Arduino such an amazing machine!
Please,I need some help.I want to make Arduino act as web server with possibility to set network parameters from Serial Monitor (IP,MAC,Gateway,etc).When I try to read the Serial Monitor's buffer,nothing happens.Please see the code below.
Another issue is that: the Ethernet/WiFiServer object is initialized with MAC adress composed of 6 byte,but in the sketch examples,is composed of 6 hex values,bigger in size than byte type.
If I want to take MAC from Serial Monitor and store it to EEPROM, should I convert it somehow to hex after read it back from EEPROM,in order ot start server? Thank you very much for help,have a great day!
while(Serial.available()==0){;}
char ch;
int i=0;
while(Serial.available()>0)
{
ch=Serial.read();
buffer[i++]=ch;
}
As soon as there is at least one byte to read, start reading them all. How many do you suppose will have arrived when the first while loop ends? Any answer other than ONE is wrong.
but in the sketch examples,is composed of 6 hex values,bigger in size than byte type
Thank you very,very much groundFungus! That was very useful !
You're right PaulS, I've asked the wrong question !
So, in this statement: "byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};" how can an array of bytes
hold these hex values? And more important,if I got from Serial Monitor a string like:
"0xDE:0xAD:0xBE:0xEF:0xFE:0xED" and I've devided it in 6 substrings like: "0xDE", how do I store those
values in EEPROM, in order to read them back and pass them to Ethernet.begin() ?
Should I remove th "0x" part then split "DE" in 2 different bytes, and write them in EEPROM ?
Thanks a lot wvmarle!
I thought that the decimal value of an hex representation is concatenation of each
hex digit's decimal value, in my case, D=13, E=14,so the result is 1314 !
The fact that are so many topics about "storing MAC address" is because,like me, newbies fail to
know/understand hex representation !
Please,if you don't mind, can you tell me how does that work?
P.S: I haven't used yet the code above, cause first I want to know exactly how hex representation
works.Thank you!