The code doesn't upload on firebase at all
also the esp8266 is connected to wifi
Firebase.begin(FIREBASE_HOST,FIREBASE_AUTH);
the underline word "Firebase" is not highlighted orange could it be a problem ?
#include <FirebaseESP8266.h>
#include "./esppl_functions.h"
#define WIFI_SSID "Sonson"
#define WIFI_PASSWORD "hassan13"
#define FIREBASE_HOST "https://friend-detector-e9036.firebaseio.com/"
#define FIREBASE_AUTH "1AAjJuU7CbSXu2P90GvChDCRGi58I3fdmtWELhW6"
FirebaseData firebaseData;
#define LIST_SIZE 7
uint8_t friendmac[LIST_SIZE][ESPPL_MAC_LEN] = {
{0x08, 0xc5, 0xe1, 0xb1, 0xec, 0x43}
,{0xc8, 0x3d, 0xd4, 0xf8, 0x41, 0x2b}
,{0x80, 0x01, 0x84, 0x14, 0xf5, 0x0f}
,{0xec, 0xf3, 0x42, 0x35, 0x7c, 0x40}
,{0xc4, 0x3a, 0xbe, 0xa4, 0x0c, 0xa0}
,{0xc0, 0x17, 0x4d, 0xd3, 0xd8, 0x0f}
,{0x20, 0x47, 0xda, 0x3d, 0x69, 0x3b}
};
String friendname[LIST_SIZE] = {
"note9"
,"lap"
, "Said"
, "Nada"
, "Aya"
, "khaled"
, "Sohaila"
};
bool frienddetected[] = {false, false,false,false,false};
void setup() {
delay(500);
Serial.begin(115200);
Serial.println("Started...");
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.print("connecting");
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(500);
Firebase.begin(FIREBASE_HOST,FIREBASE_AUTH);
}
esppl_init(cb);
}
/* You cannot use a time delay here to keep the LED on, so will need to use ratio of
detected packets to overall packets to keep LED on for longer. If you try to use a
delay to keep the light on for long enough to be useful, the watchdog timer kills the
process and it dies */
int cooldown = 0; /* This variable will be a cooldown timer to keep the LED on for longer, we'll set it to 1000 if we
detect a packet from a device with a MAC address on the list, and then keep the LED on till we get 1000 packets that
are NOT from any device on the list. */
/* end exparimental variable package */
bool maccmp(uint8_t *mac1, uint8_t *mac2) {
for (int i=0; i < ESPPL_MAC_LEN; i++) {
if (mac1[i] != mac2[i]) {
return false;
}
}
return true;
}
void cb(esppl_frame_info *info) {
for (int i=0; i<LIST_SIZE; i++) {
if (( maccmp(info->sourceaddr, friendmac[i]) || maccmp(info->receiveraddr, friendmac[i])) && frienddetected[i] == false) {
frienddetected[i] = true;
Serial.printf("\n%s is here! :)", friendname[i].c_str());
Firebase.setString(firebaseData,"/Attendance/0",friendname[i]);
cooldown = 10; // here we set it to 1000 if we detect a packet that matches our list
}}}
void loop() {
esppl_sniffing_start();
while (true) {
for (int i = ESPPL_CHANNEL_MIN; i <= ESPPL_CHANNEL_MAX; i++ ) {
esppl_set_channel(i);
while (esppl_process_frames()) {
//
}
}
}
}
