Phone-Activated Talking Dog Collar

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
MOCKLE
 
Posts: 12
Joined: Sun May 16, 2021 10:37 am

Phone-Activated Talking Dog Collar

Post by MOCKLE »

Hello have the Adafruit Feather 32u4 Bluefruit LE keep getting an error

BLEdogCollar:16:10: fatal error: Adafruit_BluefruitLE_SPI.h: No such file or directory
#include <Adafruit_BluefruitLE_SPI.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
Adafruit_BluefruitLE_SPI.h: No such file or directory

Is there an updated code to use thank you
Attachments
ADA Error.jpg
ADA Error.jpg (104.31 KiB) Viewed 286 times

User avatar
dastels
 
Posts: 15662
Joined: Tue Oct 20, 2015 3:22 pm

Re: Phone-Activated Talking Dog Collar

Post by dastels »

Have you read through the Feather 32u4 BLE tutorial? https://learn.adafruit.com/adafruit-fea ... uefruit-le

Dave

User avatar
MOCKLE
 
Posts: 12
Joined: Sun May 16, 2021 10:37 am

Re: Phone-Activated Talking Dog Collar

Post by MOCKLE »

Code: Select all

// Smartphone-activated audio gizmo (e.g. talking dog collar).
// Uses the following Adafruit parts:
//
// - Bluefruit LE Micro (adafruit.com/product/2661)
// - 500 mAh LiPoly battery (1578)
// - LiPoly backpack (2124)
// - Audio FX Mini sound board (2342 or 2341)
// - 2.5W class D mono amp (2130)
// - Speaker (TBD)
//
// Needs Adafruit_BluefruitLE_nRF51 and Adafruit_Soundboard libs:
// github.com/adafruit

#include <SPI.h>
#include <SoftwareSerial.h>
#include <Adafruit_BluefruitLE_SPI.h>
#include <Adafruit_Soundboard.h>

#define LED         A0 // LED on while "talking"
#define AUDIO_ACT   5  // "Act" on Audio FX
#define AUDIO_RESET 6  // "Rst" on Audio FX

Adafruit_Soundboard      sfx(&Serial1, NULL, AUDIO_RESET);
Adafruit_BluefruitLE_SPI ble(8, 7, 4); // CS, IRQ, RST pins

char filename[12] = "        OGG"; // Tail end of filename NEVER changes

// PROGMEM string arrays are wretched, and sfx.playTrack() expects a
// goofy fixed-length space-padded filename...we take care of both by
// declaring all the filenames inside one big contiguous PROGMEM string
// (notice there are no commas here, it's all concatenated), and copying
// an 8-byte section as needed into filename[].  Some waste, but we're
// not hurting for space.  If you change or add any filenames, they MUST
// be padded with spaces to 8 characters, else there will be...trouble.
static const char PROGMEM bigStringTable[] =  // play() index
  "1       " "2       " "3       " "4       " //  0-3
  "5       " "6       " "7       " "8       " //  4-7
  "BOOT    ";                                 //  8-

void fail(uint16_t ms) { // If startup error, LED flash indicates status
  for(uint8_t x=0;;) {
    digitalWrite(LED, ++x & 1);
    delay(ms);
  }
}

void setup(void) {
  pinMode(LED, OUTPUT);
  digitalWrite(LED, HIGH);         // LED steady on during init
  Serial1.begin(9600);             // Audio FX serial link
  if(!sfx.reset())      fail(250); // Audio FX init error?  Slow blink
  if(!ble.begin(false)) fail(100); // BLE init error?  Fast blink
  ble.echo(false);
  digitalWrite(LED, LOW);          // LED off = successful init
  play(8);                         // Play startup sound
}

void loop(void) {
  if(ble.isConnected()) {
    ble.println(F("AT+BLEUARTRX"));     // Request string from BLE module
    ble.readline();                     // Read outcome
    if(!strncmp(ble.buffer, "!B", 2) && // Controller button command
       checkCRC(255-'!'-'B', 4)      && // Verify checksum
       (ble.buffer[3] == '1')) {        // Button press? 1=press 0=release
      play(ble.buffer[2] - '1');
    }
    ble.waitForOK();
  }
}

boolean checkCRC(uint8_t sum, uint8_t CRCindex) {
  for(uint8_t i=2; i<CRCindex; i++) sum -= (uint8_t)ble.buffer[i];
  return ((uint8_t)ble.buffer[CRCindex] == sum);
}

void play(uint16_t i) {
  digitalWrite(LED, HIGH);
  memcpy_P(filename, &bigStringTable[i * 8], 8); // PROGMEM -> RAM
  sfx.playTrack(filename);
  delay(250); // Need this -- some delay before ACT LED is valid
  while(digitalRead(AUDIO_ACT) == LOW); // Wait for sound to finish
  digitalWrite(LED, LOW);
} 
Last edited by Franklin97355 on Sun Oct 31, 2021 1:39 pm, edited 1 time in total.
Reason: Added code tags

User avatar
MOCKLE
 
Posts: 12
Joined: Sun May 16, 2021 10:37 am

Re: Phone-Activated Talking Dog Collar

Post by MOCKLE »

this code does not work..

User avatar
dastels
 
Posts: 15662
Joined: Tue Oct 20, 2015 3:22 pm

Re: Phone-Activated Talking Dog Collar

Post by dastels »

Needs Adafruit_BluefruitLE_nRF51 and Adafruit_Soundboard libs
Did you install those libraries?

Dave

User avatar
MOCKLE
 
Posts: 12
Joined: Sun May 16, 2021 10:37 am

Re: Phone-Activated Talking Dog Collar

Post by MOCKLE »

yes
Attachments
pb.jpg
pb.jpg (113.51 KiB) Viewed 254 times

User avatar
dastels
 
Posts: 15662
Joined: Tue Oct 20, 2015 3:22 pm

Re: Phone-Activated Talking Dog Collar

Post by dastels »

It looks like you have the board set to Arduino UNO. The Tools->Board setting should match the hardware you are using, "Adafruit Feather 32u4" in this case.

Dave

User avatar
MOCKLE
 
Posts: 12
Joined: Sun May 16, 2021 10:37 am

Re: Phone-Activated Talking Dog Collar

Post by MOCKLE »

dastels wrote:It looks like you have the board set to Arduino UNO. The Tools->Board setting should match the hardware you are using, "Adafruit Feather 32u4" in this case.

Dave
that is correct I followed the instruction and nothing
Attachments
dont know.jpg
dont know.jpg (335.77 KiB) Viewed 247 times

User avatar
MOCKLE
 
Posts: 12
Joined: Sun May 16, 2021 10:37 am

Re: Phone-Activated Talking Dog Collar

Post by MOCKLE »

now when i plug it in this pops up
Attachments
dont know20.jpg
dont know20.jpg (16.58 KiB) Viewed 247 times

User avatar
dastels
 
Posts: 15662
Joined: Tue Oct 20, 2015 3:22 pm

Re: Phone-Activated Talking Dog Collar

Post by dastels »

Go to the "Tools->Board->Adafruit Boards" menu and select "Adafruit Feather 32u4". If you don't see it there install "Adafruit AVR Boards".
See https://learn.adafruit.com/adafruit-fea ... t-le/setup for more details.

Dave

User avatar
MOCKLE
 
Posts: 12
Joined: Sun May 16, 2021 10:37 am

Re: Phone-Activated Talking Dog Collar

Post by MOCKLE »

ok got that far and will not connect
Attachments
adas.jpg
adas.jpg (632.23 KiB) Viewed 230 times
dont know20.jpg
dont know20.jpg (16.58 KiB) Viewed 230 times

User avatar
MOCKLE
 
Posts: 12
Joined: Sun May 16, 2021 10:37 am

Re: Phone-Activated Talking Dog Collar

Post by MOCKLE »

port
Attachments
port.jpg
port.jpg (77.39 KiB) Viewed 228 times

User avatar
MOCKLE
 
Posts: 12
Joined: Sun May 16, 2021 10:37 am

Re: Phone-Activated Talking Dog Collar

Post by MOCKLE »

board does not work????

User avatar
dastels
 
Posts: 15662
Joined: Tue Oct 20, 2015 3:22 pm

Re: Phone-Activated Talking Dog Collar

Post by dastels »

This seems to be getting Windows specific where I am of no use. All I can suggest is try changing the cable to a different USB port. I find that can help on Linux.

Dave

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: Phone-Activated Talking Dog Collar

Post by adafruit_support_carter »

How is the board showing up in Windows Device Manager once connected?

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”