Adafruit Feather 32u4 Data Transfer Speed

Hi there!

I am trying to do a simple calculation of the data transfer rate by comparing two millis() functions. I have an issue with one of my Timestamp millis functions. When my for loop starts, the Timestamp millis function stops. Does anyone know how I can fix this? I’ve posted a snippet of my code below! :slight_smile:

#include <Arduino.h>
#include <SPI.h>
#include “Adafruit_BLE.h”
#include “Adafruit_BluefruitLE_SPI.h”
#include “Adafruit_BluefruitLE_UART.h”

/=========================================================================
-----------------------------------------------------------------------
/
#define FACTORYRESET_ENABLE 1
#define MINIMUM_FIRMWARE_VERSION “0.6.6”
#define MODE_LED_BEHAVIOUR “MODE”
/=========================================================================/

int testData = 0; // variable to hold the analog value
unsigned long Timestamp;
unsigned long transferTime;
unsigned long totalTime;
unsigned long averageTime;

void setup() {

// put your setup code here, to run once:
testData = analogRead(0);
Timestamp = millis();

for (int i = 1; i <= 10; i++)
{
//ble.print(“AT+BLEUARTTX=\r\n”);

transferTime = millis();
//ble.println(testData); // print as an ASCII-encoded decimal on ble device

Serial.print("Test Data: ");
Serial.println(testData); // print as an ASCII-encoded decimal on terminal

Serial.print("Time Since Program began: "); // Print counter of time since program began in milliseconds
Serial.println(Timestamp);

Serial.print("transferTime: "); // Print counter of time since program began in milliseconds
Serial.println(transferTime);

delay(1000); // One second delay on data output
} return transferTime, Timestamp;

}

void loop() {
// put your main code here, to run repeatedly:
/*

  • CALCULATE AVERAGE TIME IN MILLIS
    /
    totalTime = transferTime-Timestamp;
    averageTime = totalTime/20;
    /
  • PRINT ADVERAGE TIME
    */
    Serial.println("AVERAGE TIME OF DATA SPEED: ");
    Serial.println(averageTime);
    delay(10000);
    }

That code doesn't compile.

Apologies! I've updated the code!!