Modular ESP Firmware - Baseline - Declarations and Defines

From The TinkerNet Wiki
Jump to navigation Jump to search

In TopSecret.h

 1 #ifndef TOPSECRET_H
 2 #define TOPSECRET_H
 3 
 4 // WiFi
 5 // Store your WiFi credentials here.
 6 // Update these with values suitable for your network.
 7 
 8 #define WAP 0
 9 // This #define & #if stuff is a good way to build for multiple WiFi networks
10 // (at least for testing...)
11 // If you only have a single WiFi network, boil it down to one of each "WiFi_ssid"
12 // & "WiFi_password"
13 //
14 // (Maybe later, I'll update this for adding in multiples with automatic selection...)
15 
16 #if WAP==0
17 const char* WiFi_ssid = "YOURSSID";
18 const char* WiFi_password = "YOURPASSWORD";
19 #elif WAP==1
20 const char* WiFi_ssid = "YOURSSID-b";
21 const char* WiFi_password = "YOURPASSWORD-b";
22 #elif WAP==2
23 const char* WiFi_ssid = "YOURSSID-c";
24 const char* WiFi_password = "YOURPASSWORD-c";
25 #else
26 const char* WiFi_ssid = "YOURSSID-d";
27 const char* WiFi_password = "YOURPASSWORD-d";
28 #endif
29 
30 const char* WiFi_ClientName = "GimmeAName";
31 
32 #endif // TOPSECRET_H

In functions.h

 1 #ifndef FUNCTIONS_H
 2 #define FUNCTIONS_H
 3 
 4 #include <stdint.h>
 5 #include <Arduino.h>
 6 
 7 #include <ESP8266WiFi.h>
 8 
 9 void setup_wifi();
10 
11 #endif // FUNCTIONS_H