- Sun Oct 04, 2015 12:21 pm
#30489
Ok, this is my code so far, it's throwing tons of errors when I verify it:
Code: Select all
/* Create a WiFi access point */
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#define WIFI_MODE_AP
/* Set these to your desired credentials. */
const char *ssid = "Proximity Trigger 1";
const char *password = "thereisnospoon";
//Reference as station counter as "devices"
unsigned char devices;
ESP8266WebServer server(80);
/* Just a little test message. Go to http://192.168.4.1 in a web browser
* connected to this access point to see it.
*/
void handleRoot() {
}
void setup() {
delay(1000);
Serial.begin(115200);
Serial.println();
Serial.print("Configuring access point...");
/* You can remove the password parameter if you want the AP to be open. */
WiFi.softAP(ssid, password);
IPAddress myIP = WiFi.softAPIP();
Serial.print("AP IP address: ");
Serial.println(myIP);
server.on("/", handleRoot);
server.begin();
pinMode(2, OUTPUT);
digitalWrite(2, LOW);
devices = wifi_softap_get_station_num();
}
void loop() {
if (devices) >= 1;
digitalWrite(2, HIGH);
delay(1000);
digitalWrite(2,LOW);
else if (devices) <= 1;
digitalWrite(2,HIGH);
delay(1000);
digitalWrite(2,LOW);
server.handleClient();
}
}
And these are the errors I'm getting:
"Arduino: 1.6.5 (Windows 7), Board: "Generic ESP8266 Module, Serial, 80 MHz, 40MHz, DIO, 115200, 512K (64K SPIFFS)"
Proximity_Toggle_10_4_2015.ino: In function 'void setup()':
Proximity_Toggle_10_4_2015:41: error: 'wifi_softap_get_station_num' was not declared in this scope
Proximity_Toggle_10_4_2015.ino: In function 'void loop()':
Proximity_Toggle_10_4_2015:45: error: expected primary-expression before '>=' token
Proximity_Toggle_10_4_2015:50: error: 'else' without a previous 'if'
Proximity_Toggle_10_4_2015:50: error: expected primary-expression before '<=' token
Proximity_Toggle_10_4_2015.ino: At global scope:
Proximity_Toggle_10_4_2015:57: error: expected declaration before '}' token
'wifi_softap_get_station_num' was not declared in this scope
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences."
I still needs some tips please.