So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By Narfel
#78719 Just a quick theory question. If i want to for example print the ip with WiFi.localIP() to multiple outputs (Serial, LCD...). What is better, calling WiFi.localP() multiple times or store it in a (string?) variable and print said variable? I'm not sure what exactly happens when i just call that vs. storing a variable.

Why I'm asking this possibly weird noob question: i learned that the IPAddress isn't - as i thought - a simple string, but a a whole class with its own header IPAddress.h. I then was wondering if storing (and possibly converting it into a string) was necessary at all if i can just for example Serial.print(WiFi.localIP()[3]) to get just the last octet printed in the console and the whole address on a LCD with WiFi.localIP().
User avatar
By rudy
#78724 I have never worried about it. I just call it again when I write to the LCD. It may take more CPU cycles that storing it, but I think that is better than using up more ram with strings. Just my opinion. I'm not a programmer.