Basically I want to write the output to an SD Card.
I have managed to successfully wire up the card, initialize it and Write the headings to a file, what I cannot do is write the updated data as its displayed in the serial output.
I was hoping someone could provide some guidance and possibly some code example on how to write the serial output to a file.
void setup() {
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.printf("\n\nSDK version:%s\n\r", system_get_sdk_version());
Serial.println(F("ESP8266 mini-sniff by Ray Burnette http://www.hackster.io/rayburne/projects"));
Serial.println(F("Type: /-------MAC------/-----WiFi Access Point SSID-----/ /----MAC---/ Chnl RSSI"));
Serial.print("Initializing SD card...");
// see if the card is present and can be initialized:
if (!SD.begin(2)) {
Serial.println("Card failed, or not present");
// don't do anything more:
return;
}
Serial.println("card initialized.");
dataFile = SD.open("datalog.txt", FILE_WRITE);
if (dataFile) {
dataFile.println("Type: /-------MAC------/-----WiFi Access Point SSID-----/ /----MAC---/ Chnl RSSI");
dataFile.close();
}
wifi_set_opmode(STATION_MODE); // Promiscuous works only with station mode
wifi_set_channel(channel);
wifi_promiscuous_enable(disable);
wifi_set_promiscuous_rx_cb(promisc_cb); // Set up promiscuous callback
wifi_promiscuous_enable(enable);
}
void loop() {
channel = 1;
wifi_set_channel(channel);
while (true) {
nothing_new++; // Array is not finite, check bounds and adjust if required
if (nothing_new > 200) {
nothing_new = 0;
channel++;
if (channel == 15) break; // Only scan channels 1 to 14
wifi_set_channel(channel);
}
delay(1); // critical processing timeslice for NONOS SDK! No delay(0) yield()
// Press keyboard ENTER in console with NL active to repaint the screen
if ((Serial.available() > 0) && (Serial.read() == '\n')) {
Serial.println("\n-------------------------------------------------------------------------------------\n");
for (int u = 0; u < clients_known_count; u++) print_client(clients_known); for (int u = 0; u < aps_known_count; u++) print_beacon(aps_known); Serial.println("\n-------------------------------------------------------------------------------------\n"); } } }
It would appear that @ess would rather spend their precious time registering as a new member and insulting existing members, than read a few simple posting guidelines.