Back to Parent

/*
  BLE_Peripheral.ino
​
  This program uses the ArduinoBLE library to set-up an Arduino Nano 33 BLE 
  as a peripheral device and specifies a service and a characteristic. Depending 
  of the value of the specified characteristic, an on-board LED gets on. 
​
  The circuit:
  - Arduino Nano 33 BLE. 
​
  This example code is in the public domain.
*/
​
​
#include <Adafruit_NeoPixel.h>
#include <ArduinoBLE.h>
​
int lamp1 [] = {
0,1,1,1,0,1,1,1, 0,1,1,0,0,1,0,1, 0,1,1,0,1,1,0,0, 0,1,1,0,0,0,1,1, 0,1,1,0,1,1,1,1, 0,1,1,0,1,1,0,1, 0,1,1,0,0,1,0,1, 0,0,1,0,0,0,0,0, 
0,1,1,1,0,1,0,0, 0,1,1,0,1,1,1,1, 0,0,1,0,0,0,0,0, 0,1,1,1,0,1,0,0, 0,1,1,0,1,0,0,0, 0,1,1,0,0,1,0,1, 0,0,1,0,0,0,0,0, 0,1,1,0,1,1,1,1, 
0,1,1,1,0,1,0,1, 0,1,1,1,0,0,1,1, 0,1,1,0,0,1,0,1, 0,0,1,0,0,0,0,0, 0,1,1,0,1,1,1,1, 0,1,1,0,0,1,1,0, 0,0,1,0,0,0,0,0, 0,1,1,0,1,0,0,0, 
0,1,1,0,0,0,0,1, 0,1,1,0,0,1,0,0, 0,1,1,0,0,1,0,1, 0,1,1,1,0,0,1,1, 0,0,1,0,0,0,0,0, 0,1,1,1,0,1,1,1, 0,1,1,0,1,0,0,0, 0,1,1,0,0,1,0,1, 
0,1,1,1,0,0,1,0, 0,1,1,0,0,1,0,1, 0,1,1,1,0,0,1,1, 0,1,1,1,0,0,1,1, 0,1,1,1,0,0,1,1, 0,0,1,0,0,0,0,0, 0,1,1,1,0,1,1,1, 0,1,1,0,0,0,0,1, 
0,1,1,1,0,1,0,0, 0,0,1,0,0,0,0,0, 0,1,1,0,1,0,0,1, 0,0,1,0,0,0,0,0, 0,1,1,0,1,0,1,1, 0,1,1,0,1,1,1,0, 0,1,1,0,1,1,1,1, 0,1,1,1,0,1,1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0,1,1,0,1,1,1,1, 0,1,1,0,1,0,1,1, 0,1,1,0,0,1,0,1, 0,1,1,0,1,1,1,0, 0,0,1,0,0,0,0,0, 0,1,1,0,0,1,0,0, 0,1,1,0,1,0,0,1, 0,1,1,0,0,1,1,1, 0,1,1,0,1,1,1,0, 0,1,1,0,1,0,0,1, 0,1,1,1,0,1,0,0, 0,1,1,1,1,0,0,1, 0,1,1,1,0,0,1,1
};
​
​
int size1 = sizeof(lamp1) / sizeof(lamp1[0]);
int size2 = sizeof(lamp2) / sizeof(lamp2[0]);
​
//ARDUINO PINS
#define PIXEL_PIN D3
int relayPin1 = D4;
const int fairyPin = D9;
​
const int comPin1 = A0;
​
int av;
int ledCount = 0;
​
int fairyCount = 0;
​
int prevMode;
​
​
//LED STRIP
​
#define PIXEL_COUNT 29
#define PIXEL_TYPE NEO_GRB + NEO_KHZ800
int n = size2 / PIXEL_COUNT;
int nCount = 0;
Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);
​
//SENSORS + MULTIPLEXER
const int nSensors = 8;
​
int sensorVals[15];
//Mux control pins
int s0 = D12;
int s1 = D11;
int s2 = D10;
​
bool final [] {false, false};
​
//UWB
const int default0 = 0;
const int default1 = 1;
const int default2 = 2;
const int ledPin = LED_BUILTIN;
​
void play(int mode) {
  if (mode == 0) { //NOT IN ROOM
    // DEFAULT 'TALKING' BEHAVIORS ///
    sleepyDefault();
    delay(100);
    angryDefault();
    delay(100);
    curiousDefault();    
    Serial.println(0);
    delay(200);
​
  } else if (mode == 1) { //in the room, but not shaking
    av = readMux(sensorVals);
    curiousActivate();
    Serial.println(1);
    delay(200);
​
  } else if (mode == 2) { // in the room, is shaking
    allFlashing();
    //angryFlashing();
    //curiousFlashing();
    //sleepyFlashing();
    Serial.println(2);
    delay(200);
  }
}
​
//////////////////////////////////// SETUP ////////////////////////////////////////////////////////
​
void setup() {
  //Serial.begin(9600);
  Serial.begin(115200);
​
  // begin initialization
  if (!BLE.begin()) {
    Serial.println("starting BLE failed!");
    while (1);
  }
  Serial.println("BLE Central - Receiver");
  Serial.println("Make sure to turn on the device.");
​
  // start scanning for peripheral
  BLE.scan();
  // Set built-in LED to OUTPUT mode
  pinMode(LED_BUILTIN, OUTPUT); // Set red LED pin as an output
  
​
  //MULTIPL...
Click to Expand

Content Rating

Is this a good/useful/informative piece of content to include in the project? Have your say!

0