   blePeripheral.setAdvertisedServiceUuid(batteryService.uuid());  // add the service UUID
   blePeripheral.addAttribute(batteryService);   // Add the BLE Battery service
   blePeripheral.addAttribute(batteryLevelChar); // add the battery level characteristic
-  batteryLevelChar.setValue(oldBatteryLevel);   // initial value for this characteristic
+  batteryLevelChar.setValue(oldFlexAngle);   // initial value for this characteristic
 
   /* Now activate the BLE device.  It will start continuously transmitting BLE
      advertising packets and will be visible to remote BLE central devices

// Include BLE files.
#include <CurieBLE.h>

//BLE Characteristics
BLEPeripheral blePeripheral;       // BLE Peripheral Device (the board you're programming)
BLEService batteryService("180F"); // BLE Battery Service

// BLE Battery Level Characteristic"
BLEUnsignedCharCharacteristic batteryLevelChar("2A19",  // standard 16-bit characteristic UUID
    BLERead | BLENotify);     // remote clients will be able to
// get notifications if this characteristic changes

long previousMillis = 0;  // last time the battery level was checked, in ms

const int FLEX_PIN = A0; // Pin connected to voltage divider output

// Measure the voltage at 5V and the actual resistance of your
// 47k resistor, and enter them below:
const float VCC = 4.98; // Measured voltage of Ardunio 5V line
const float R_DIV = 47500.0; // Measured resistance of 3.3k resistor

// Upload the code, then try to adjust these values to more
// accurately calculate bend degree.
const float STRAIGHT_RESISTANCE = 37300.0; // resistance when straight
const float BEND_RESISTANCE = 90000.0; // resistance at 90 deg

float oldFlexAngle = 0;  // last battery level reading from analog input

void setup() 
{

    Serial.print("Connected to central: ");
    // print the central's MAC address:
    Serial.println(central.address());
    // check the flex angle every 200ms as long as the central is still connected:
    while (central.connected()) {
      long currentMillis = millis();
      // if 200ms have passed, check the flex angle:
      if (currentMillis - previousMillis >= 200) {
        previousMillis = currentMillis;
        updateFlexAngle();
