FishinoHomeAuto - Page 2Sketch upload
Let's open the FishinoHomeAuto.ino sketch inside IDE, choosing it among Fishino library's examples; we're using our FishIDE application, but you can use Arduino IDE as usual.
We can see in the picture the opened sketch, with editor positioned near some elements which we shall adapt to our WiFi networki.
At first we shall decide if use our existing WiFi framework, connecting Fishino board to our router, or if we prefere have Fishino to create a new WiFi network; for that reason we've foreseen the following define
Activating it (removing the 2 // comment slashes) our Fishino will operate in standalone mode, building its WiFi infrastructure based on following parameters; if we comment it the board will connect to our home router.
Next we have the usual SSID and PASSWORD :
#define MY_SSID "sweethome" #define MY_PASS "1234"
Here we shall insert our router's access parameters, if we operate in station mode (NOT standalone); otherwise we shall choose an SSID name and a password for standalone mode.
Last but not least, we've IP, GATEWAY e NETMASK:
#define IPADDR 192, 168, 1, 10 #define GATEWAY 192, 168, 1, 1 #define NETMASK 255, 255, 255, 0
In STANDALONE mode we shall use an IP and a GATEWAY in a DIFFERENT subnet as our home network, otherwise we'll have connection problems and something won't work. For example, if our home network's address is of kind 192.168.1.XXX we can choose the subnet 192.168.100.xxx.
If we want to work in normal mode (NOT STANDALONE) we need to use SAME SUBNET as our home WiFi network AND a FREE IP, or let DHCP do its job using a dynamic IP, commenting the 3 lines above.
Dynamic IP makes things easier on Fishino's side, but complicates them later, as we shall look for assigned dynamic IP address on serial monitor.