WI-FI RANGE SCANNER

Код:
#include 
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"
#include 
#include 

#define BuzzerPin   15
#define OLED_RESET  24
#define OLED_DC     26
#define OLED_CS     31

RF24 radio(3, 4);
Adafruit_SSD1306 display(OLED_DC, OLED_RESET, OLED_CS);

const uint8_t num_channels = 128;
uint8_t values[num_channels];
const int num_reps = 100;

void setup(void)
{
  display.begin(SSD1306_SWITCHCAPVCC);
  display.setTextColor(WHITE);
  display.clearDisplay();
  display.display();
  display.setCursor(0, 0);

  display.println("Loading...");
  display.display();
  Serial.begin(57600);
  printf_begin();
  printf("\n\rRF24/examples/scanner/\n\r");

  radio.begin();
  radio.setAutoAck(false);

  radio.startListening();
  radio.stopListening();

  int i = 0;
  while ( i < num_channels )
  {
    printf("%x", i >> 4);
    ++i;
  }
  printf("\n\r");
  i = 0;
  while ( i < num_channels )
  {
    printf("%x", i & 0xf);
    ++i;
  }
  printf("\n\r");
  CreateStartScrean();
}

void loop(void)
{
  memset(values, 0, sizeof(values));

  int rep_counter = num_reps;
  while (rep_counter--)
  {
    int i = num_channels;
    while (i--)
    {
      radio.setChannel(i);

      radio.startListening();
      delayMicroseconds(225);
      if ( radio.testCarrier() ) {
        ++values[i];
      }
      radio.stopListening();
    }
    if (rep_counter % 5  == 0) {
      display.write(218);
      tone(BuzzerPin, 500, 150);
      display.display();
    }
  }

  int i = 0;
  tone(BuzzerPin, 1000, 200);
  CreateStartScrean();
  while ( i < num_channels )
  {
    display.drawLine(i, 63, i, 63 - values[i], 1);
    printf("%x", min(0xf, values[i] & 0xf));
    ++i;
  }
  printf("\n\r");
  display.display();
}

void CreateStartScrean()
{
  display.clearDisplay();
  display.setCursor(0, 0);
  display.println F("Progress: ");
  for (int k = 0 ; k < 20; k ++) {
    display.write(176);
  }
  display.setCursor(0, 8);
}