It's šŸCircuitPython MondayšŸ at Adafruit! Use the code ADATY to get 20% off CircuitPython and 15% off items storewide!
0

Phone-Activated Talking Dog Collar
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Phone-Activated Talking Dog Collar

by MOCKLE on Wed Oct 27, 2021 8:26 am

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 201 times

MOCKLE
 
Posts: 11
Joined: Sun May 16, 2021 10:37 am

Re: Phone-Activated Talking Dog Collar

by dastels on Wed Oct 27, 2021 10:42 am

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

Dave

dastels
 
Posts: 7890
Joined: Tue Oct 20, 2015 3:22 pm

Re: Phone-Activated Talking Dog Collar

by MOCKLE on Wed Oct 27, 2021 11:57 am

Code: Select all | TOGGLE FULL SIZE
// 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

MOCKLE
 
Posts: 11
Joined: Sun May 16, 2021 10:37 am

Re: Phone-Activated Talking Dog Collar

by MOCKLE on Wed Oct 27, 2021 11:57 am

this code does not work..

MOCKLE
 
Posts: 11
Joined: Sun May 16, 2021 10:37 am

Re: Phone-Activated Talking Dog Collar

by dastels on Wed Oct 27, 2021 3:34 pm

Needs Adafruit_BluefruitLE_nRF51 and Adafruit_Soundboard libs


Did you install those libraries?

Dave

dastels
 
Posts: 7890
Joined: Tue Oct 20, 2015 3:22 pm

Re: Phone-Activated Talking Dog Collar

by MOCKLE on Thu Oct 28, 2021 7:13 am

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

MOCKLE
 
Posts: 11
Joined: Sun May 16, 2021 10:37 am

Re: Phone-Activated Talking Dog Collar

by dastels on Thu Oct 28, 2021 9:05 am

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

dastels
 
Posts: 7890
Joined: Tue Oct 20, 2015 3:22 pm

Re: Phone-Activated Talking Dog Collar

by MOCKLE on Thu Oct 28, 2021 12:13 pm

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 162 times

MOCKLE
 
Posts: 11
Joined: Sun May 16, 2021 10:37 am

Re: Phone-Activated Talking Dog Collar

by MOCKLE on Thu Oct 28, 2021 12:15 pm

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

MOCKLE
 
Posts: 11
Joined: Sun May 16, 2021 10:37 am

Re: Phone-Activated Talking Dog Collar

by dastels on Thu Oct 28, 2021 12:34 pm

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-feather-32u4-bluefruit-le/setup for more details.

Dave

dastels
 
Posts: 7890
Joined: Tue Oct 20, 2015 3:22 pm

Re: Phone-Activated Talking Dog Collar

by MOCKLE on Fri Oct 29, 2021 7:42 am

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

MOCKLE
 
Posts: 11
Joined: Sun May 16, 2021 10:37 am

Re: Phone-Activated Talking Dog Collar

by MOCKLE on Fri Oct 29, 2021 7:44 am

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

MOCKLE
 
Posts: 11
Joined: Sun May 16, 2021 10:37 am

Re: Phone-Activated Talking Dog Collar

by MOCKLE on Sat Oct 30, 2021 10:08 am

board does not work????

MOCKLE
 
Posts: 11
Joined: Sun May 16, 2021 10:37 am

Re: Phone-Activated Talking Dog Collar

by dastels on Sun Oct 31, 2021 10:22 am

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

dastels
 
Posts: 7890
Joined: Tue Oct 20, 2015 3:22 pm

Re: Phone-Activated Talking Dog Collar

by adafruit_support_carter on Sun Oct 31, 2021 10:57 am

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

adafruit_support_carter
 
Posts: 21875
Joined: Tue Nov 29, 2016 2:45 pm

Please be positive and constructive with your questions and comments.