Add option to set up for wifi or AP on compile #53

Merged
W1CDN merged 9 commits from access-point into main 2023-10-01 11:29:23 -05:00
Showing only changes of commit 5e3503b497 - Show all commits

View File

@ -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);