Add option to set up for wifi or AP on compile #53
|
@ -34,8 +34,8 @@ const int blinker = LED_BUILTIN;
|
|||
RTC_DS3231 rtc; // set up RTC
|
||||
const int alarmPin = 4; // pin to monitor for RTC alarms
|
||||
|
||||
// Network options: "wifi" for existing netowrk, "ap" to be an access point
|
||||
const char* network = "ap";
|
||||
// Network options: "0" for existing netowrk, "1" to be an access point
|
||||
const int network = 1;
|
||||
// Connect to existing network
|
||||
// Read from config.h
|
||||
const char* ssid = WIFI_SSID;
|
||||
|
@ -358,7 +358,7 @@ void setup() {
|
|||
}
|
||||
|
||||
WiFi.setHostname("vulpes");
|
||||
if (network == "wifi"){
|
||||
if (network == 0){
|
||||
// Attach to existing wifi
|
||||
WiFi.mode(WIFI_STA);
|
||||
WiFi.begin(ssid, password);
|
||||
|
@ -369,7 +369,7 @@ void setup() {
|
|||
Serial.println();
|
||||
Serial.print("IP Address: ");
|
||||
Serial.println(WiFi.localIP());
|
||||
} else if (network == "ap"){
|
||||
} else if (network == 1){
|
||||
// Act as new access point
|
||||
WiFi.softAPConfig(local_ip, gateway, subnet);
|
||||
WiFi.softAP(ssid_ap, password_ap);
|
||||
|
|
Loading…
Reference in New Issue
Block a user