RFduino_ULPDelay' was not declared in this scope

Hi Guys,

I am very inexperienced with arduino. Found this project to unlock a door with a smartwatch and rfduino. Build the board and want to load the code but I am getting the error RFduino_ULPDelay’ was not declared in this scope
I included the AES,RfduinoBLE,libRFduinoBLE and libRfduinoGZLL libraries. so somewhere I am missing line of code.

Thanks for looking
Jacques

Here is the code below

#include <AES.h>
#include <RFduinoBLE.h>
#include <libRFduinoBLE.h>

// LOCK SPECIFIC CONFIG

// both the key and hello values are generated by the iOS application, simply add a key under the “keys” tab
// in the iOS application and copy/paste the key and handshake information here

#define LOCK_NAME “LOCK NAME HERE”
byte key = {
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
};
char handshake = {
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
};

// END LOCK SPECIFIC CONFIG

#define CUSTOM_UUID “876d7008-890e-4d28-9b19-bfabee9f0e24”

#define COMMAND_NONE 0
#define COMMAND_LOCK 1
#define COMMAND_UNLOCK 2

#define UNLOCK_COOLDOWN_MILLIS 7000

#define LOCK_PIN 6
#define LED_PIN_R 2
#define LED_PIN_G 3
#define LED_PIN_B 4

bool locked = true;
unsigned long last_command_millis = 0;
int current_command = COMMAND_LOCK;

#define MAX_HELLO_ATTEMPTS 10

bool send_hello = false;
int hello_attempts = 0;

AES aes;

void setup()
{
Serial.begin(9600);

// setup the leds for output
pinMode(LED_PIN_R, OUTPUT);
pinMode(LED_PIN_G, OUTPUT);
pinMode(LED_PIN_B, OUTPUT);
pinMode(LOCK_PIN, OUTPUT);

RFduinoBLE.deviceName = “sl”;
RFduinoBLE.advertisementData = LOCK_NAME;
RFduinoBLE.customUUID = CUSTOM_UUID;

// start the BLE stack
RFduinoBLE.begin();
}

void loop()
{
attempt_send_hello();
check_for_unlock_timeout();
process_current_command();

// switch to lower power mode
RFduino_ULPDelay(350);
}

// COMMAND HANDLERS

void attempt_send_hello()
{
if ( send_hello == true )
{
Serial.print(“sending hello, attempt #”); Serial.println(hello_attempts);
RFduinoBLE.send(handshake, 16);

hello_attempts += 1;
if ( hello_attempts >= MAX_HELLO_ATTEMPTS )
{
send_hello = false;
hello_attempts = 0;
}
}
}

void check_for_unlock_timeout()
{
if ( locked == false )
{
// check to see if we are unlocked and the lock timeout acurred
unsigned long current_millis = millis();
if ( (current_millis - last_command_millis) > UNLOCK_COOLDOWN_MILLIS )
current_command = COMMAND_LOCK;
}
}

void process_current_command()
{
if ( current_command != COMMAND_NONE)
{
if ( current_command == COMMAND_UNLOCK )
unlock_door();
else if ( current_command == COMMAND_LOCK )
lock_door();

current_command = COMMAND_NONE;
}
}

void lock_door()
{
locked = true;
last_command_millis = millis();

analogWrite(LED_PIN_R, 255);
analogWrite(LED_PIN_G, 0);
analogWrite(LED_PIN_B, 0);

RFduinoBLE.send(‘l’);

digitalWrite(LOCK_PIN, LOW);
}

void unlock_door()
{
locked = false;
last_command_millis = millis();

analogWrite(LED_PIN_R, 0);
analogWrite(LED_PIN_G, 255);
analogWrite(LED_PIN_B, 0);

RFduinoBLE.send(‘u’);

digitalWrite(LOCK_PIN, HIGH);
}

void show_error()
{
analogWrite(LED_PIN_R, 0);
analogWrite(LED_PIN_G, 0);
analogWrite(LED_PIN_B, 255);
}

// SECURITY

int decrypt_command(char *data, int len)
{
Serial.println("-----------------------------");
Serial.print("data received, len: "); Serial.println(len);
Serial.print("data: ");

byte encrypted[len];
byte decrypted[len];

for (byte i = 0 ; i < len ; i++)
{
byte val = (byte)data*;*
_ encrypted = val;_
* Serial.print( (char)val );*
* }*

* Serial.println(" ");*
* byte success = aes.set_key( key, 128 );
_
if ( success == 0 )_
_
{_
_
success = aes.decrypt( encrypted, decrypted );_
_
if ( success == 0 )_
_
{_
_
Serial.print("Decrypted string: ");*_

* char command_char;
String time_string = “”;
_
for (byte i = 0 ; i < len ; i++)_
_
{_
_ byte val = decrypted;
Serial.print( (char)val );*_

* if ( i == 0 )*
* command_char = (char)val;
_ else*
* time_string += (char)val;*
* }*_

* Serial.println("");*

* // convert time string to timestamp*
* unsigned int timestamp = time_string.toInt();*

* Serial.print("Timestamp: "); Serial.println(timestamp);*
* Serial.print("Command: "); Serial.println(command_char);*

* // VERIFY THE TIMESTAMP*
* // we will probably need some additional hardware (wifi?) for this*
* // TODO*

* if ( command_char == ‘u’ || command_char == ‘U’ )
return COMMAND_UNLOCK;
else if ( command_char == ‘l’ || command_char == ‘L’ )
return COMMAND_LOCK;
_ }
else*
* Serial.println(“failed to decrypt string!”);
}
else*
* Serial.println(“failed to set key!”);*_

* show_error();*

* return COMMAND_NONE;
_}
// RFDUINO BLE HANDLERS*
void RFduinoBLE_onConnect()
{
* send_hello = true;
hello_attempts = 0;*

}
void RFduinoBLE_onDisconnect()
{
* // reset the hello handshake on disconnect, they don’t want to talk to us anyway :frowning:_
send_hello = false;
hello_attempts = 0;
_}
void RFduinoBLE_onReceive(char *data, int len)
{
// once we receive data, the hello handshake probably worked!_
send_hello = false;
hello_attempts = 0;*

* if ( len >= 16 )*
* current_command = decrypt_command(data, len);
_}
}*_

Your loop attempts to set a variable:
// switch to lower power mode
RFduino_ULPDelay(350);

Which has not been defined anywhere previously.

Unless the variable was defined in one of the libraries (is it?) then the complier will throw the error. You could define the variable within loop by a line:
int long RFduino_ULPDelay = 350;

then you can use it thus:
Delay(RFduino_ULPDelay);

RFduino_ULPDelay() is a function that's part of RFduino that puts the device into an ultra low power sleep state for the specified period of time.

I couldn't say what's missing though, quick google shows lots of sketches use it without needing to include other libraries, as far as I can tell. You do have the RFduino board selected right?