Skip to content

Commit

Permalink
Merge pull request #8 from kd8bxp/delay
Browse files Browse the repository at this point in the history
fixed ESP8266 device compatiablity, added setDelay for LBT
  • Loading branch information
kd8bxp authored Mar 26, 2018
2 parents bc01eb6 + 09513e6 commit a9c7084
Show file tree
Hide file tree
Showing 12 changed files with 586 additions and 860 deletions.
13 changes: 13 additions & 0 deletions New_Features.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,16 @@ This is only an example, but may find it's way into the library base at some poi
Lots of math, and comments on how it works this out.
This appears to work for any date in the 2000s. (but can be modified to work with
any date from 1700 to current * see the comments in the sketch)

Version 3.2.3
added:
setDelay(int wait)

setDelay - works with the LBT librarys, it is included with the 100+ Word Library (for both chips) but the shield works a bit different
and is only included for compatiablity between libraries. For the 100+ Word Libraries it doesn't do anything.
for the LBT library you can change the timing it pauses between words. This can have some unpredicatable results.
The timings that appear to work best is somewhere between 625 and 700. 700 is the default timing provided by the
original example skteches.

Also includes a work around/correction for ESP8266 device compile errors.

12 changes: 11 additions & 1 deletion examples/LBT_example_one/LBT_example_one.ino
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ This program is free software: you can redistribute it and/or modify
* A.M. is _am_ and P.M. is _pm_
* Based on feedback from user jjdeprisco (Thank You)
* LeRoy Miller, (C) 2018
* Ver 1.5.1
* Ver 1.5.2
Mar 19, 2018 - Cleaned up code a bit. Found a few words that didn't have underscores added and corrected. Split the libraries apart because of a problem that was found with the LBT and Orignal 100+ Word code
*/
Expand Down Expand Up @@ -72,6 +72,7 @@ Word100.begin();

void loop() {

Word100.setDelay(450); //this is probably too fast
//say the first sentence (Count to Ten)
Serial.print(arr_len(sentence));
for (int i = 0; i < arr_len(sentence); i++) {
Expand All @@ -80,6 +81,7 @@ void loop() {

delay(1000); //wait for one second

Word100.setDelay(700); //700 is the default timing for the LBT
//say the second sentence (Alert Alert intruder in zone two)
Serial.println(arr_len(sentence2));
for (int i = 0; i < arr_len(sentence2); i++) {
Expand All @@ -88,6 +90,14 @@ delay(1000); //wait for one second

delay(1000);

Word100.setDelay(550); // Here we can change the delay
/* This may have unpredictable results.
* Here is the list of all words, and you can see how
* some words are cut off.
* Somewhere between 625 and 700 appears to be good timings
* for most words.
*/

//say all the words. using the words as counters
for (int i = _colour; i < _zone+1; i++) {
Word100.say(i);
Expand Down
1 change: 1 addition & 0 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ sayNumber KEYWORD2
sayHours KEYWORD2
sayMinutes KEYWORD2
setAMPM KEYWORD2
setDelay KEYWORD2
#######################################
# Instances (KEYWORD2)
#######################################
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Word100 Library
version=3.2.2
version=3.2.3
author=LeRoy Miller
maintainer=LeRoy Miller <kd8bxp@aol.com>
sentence=Library for 100+ Word Shield and LBT
Expand Down
177 changes: 177 additions & 0 deletions src/HAMdefault.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
#ifndef default_h
#define default_h

#include "Arduino.h"


#define WORD100 1
#define MILLION 1000000
#define THOUSAND 1000
#define HUNDRED 100
#define TEN 10

//Alphabet
#define _a 0x00 //US spelling
#define _b 0x01
#define _c 0x02
#define _d 0x03
#define _e 0x04
#define _f 0x05
#define _g 0x06
#define _h 0x07
#define _i 0x08
#define _j 0x09
#define _k 0x0a
#define _l 0x0b
#define _m 0x0c
#define _n 0x0d
#define _o 0x0e
#define _p 0x0f
#define _q 0x10
#define _r 0x11
#define _s 0x12
#define _t 0x13
#define _u 0x14
#define _v 0x15
#define _w 0x16
#define _x 0x17
#define _y 0x18
#define _z 0x19

//Phonetic Alphabet
#define _alpha 0x1a
#define _bravo 0x1b
#define _charlie 0x1c
#define _delta 0x1d
#define _echo 0x1e
#define _foxtrot 0x1f
#define _golf 0x20
#define _hotel 0x21
#define _india 0x22
#define _juliet 0x23
#define _kilo 0x24
#define _lima 0x25
#define _mike 0x26
#define _november 0x27
#define _oscar 0x28
#define _papa 0x29
#define _quebec 0x2a
#define _romeo 0x2b
#define _sierra 0x2c
#define _tango 0x2d
#define _uniform 0x2e
#define _victor 0x2f
#define _whiskey 0x30
#define _xray 0x31
#define _yankee 0x32
#define _zulu 0x33

//Numbers
#define _zero 0x34
#define _0 0x34
#define _one 0x35
#define _1 0x35
#define _two 0x36
#define _2 0x36
#define _three 0x37
#define _3 0x37
#define _four 0x38
#define _4 0x38
#define _five 0x39
#define _5 0x39
#define _six 0x3a
#define _6 0x3a
#define _seven 0x3b
#define _7 0x3b
#define _eight 0x3c
#define _8 0x3c
#define _nine 0x3d
#define _9 0x3d
#define _ten 0x3e
#define _10 0x3e
#define _eleven 0x3f
#define _11 0x3f
#define _twelve 0x40
#define _12 0x40
#define _thirteen 0x41
#define _13 0x41
#define _fourteen 0x42
#define _14 0x42
#define _fifteen 0x43
#define _15 0x43
#define _sixteen 0x44
#define _16 0x44
#define _seventeen 0x45
#define _17 0x45
#define _eighteen 0x46
#define _18 0x46
#define _nineteen 0x47
#define _19 0x47
#define _twenty 0x48
#define _20 0x48
#define _thirty 0x49
#define _30 0x49
#define _forty 0x4a
#define _40 0x4a
#define _fifty 0x4b
#define _50 0x4b
#define _sixty 0x4c
#define _60 0x4c
#define _seventy 0x4d
#define _70 0x4d
#define _eighty 0x4e
#define _80 0x4e
#define _ninety 0x4f
#define _90 0x4f
#define _hundred 0x50
#define _100 0x50
#define _thousand 0x51
#define _1000 0x51
#define _million 0x52

//Words General
#define _ac 0x53
#define _amps 0x54
#define _band 0x55
#define _boardcasting 0x56
#define _calling 0x57
#define _come 0x58
#define _contact 0x59
#define _db 0x5a
#define _dc 0x5b
#define _degrees 0x5c
#define _first 0x5d
#define _frequency 0x5e
#define _giga 0x5f
#define _goodbye 0x60
#define _hello 0x61
#define _here 0x62
#define _hertz 0x63
#define _hz 0x63
#define _in 0x64
#define _incoming 0x65
#define _it 0x66
#define _key 0x67
#define _kilo 0x68
#define _last 0x69
#define _level 0x6a
#define _mega 0x6b
#define _off 0x6c
#define _ohms 0x6d
#define _on 0x6e
#define _operator 0x6f
#define _out 0x70
#define _over 0x71
#define _radio 0x72
#define _ready 0x73
#define _receiving 0x74
#define _rf 0x75
#define _sent 0x76
#define _sleep 0x77
#define _the 0x78
//#define two 0x79
#define _transmitting 0x7a
#define _volts 0x7b
#define _watts 0x7c

#endif
15 changes: 9 additions & 6 deletions src/Word100.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
#include "Word100.h"
#include <SPI.h>



/*
The "100+ Word" Arduino Audio Shield! Speak Arduino, Speak!
by Patrick Thomas Mitchell
Expand Down Expand Up @@ -38,6 +36,7 @@ This program is free software: you can redistribute it and/or modify
// GPIO 9 = STOP
// DO from Ap23 optional S4 - Not used here
// ** Add stop bit so that MCU knows then the chip has stopped talking. OUT1 is what you'll want to use

#define _STOP 9 // The STOP wire is the busy signal of the
#define _PLAY 0x98
#define _RAMPUP 0xA8 //COUT ramp up - this value never changes
Expand Down Expand Up @@ -93,7 +92,7 @@ void Word100::say(int value) // Calling this function reads words individuall
* New functions: sayNumber(), sayHours(), sayMinutes()
*/

void Word100::sayMinutes(long number) {
int Word100::sayMinutes(long number) {
if (number == 0) {

Word100::say(_zero); //special case for zero
Expand All @@ -120,7 +119,7 @@ if (_AMPM == 1) {
Word100::say(_sayAMPM); }
}

void Word100::sayHours(long number) {
int Word100::sayHours(long number) {
if (number == 0) {

Word100::say(_zero); //special case for zero
Expand Down Expand Up @@ -152,7 +151,7 @@ if (_AMPM == 1) {
}
}

void Word100::sayPeriod(int _period) {
int Word100::sayPeriod(int _period) {

int _hundreds = _period / HUNDRED;

Expand Down Expand Up @@ -181,7 +180,7 @@ if (_period == 0) { return(0); } else {
}
}

void Word100::sayNumber(long number) {
int Word100::sayNumber(long number) {

if (number == 0) {
Word100::say(_zero);
Expand All @@ -207,3 +206,7 @@ Word100::sayPeriod(number);
void Word100::setAMPM(bool AMPM) {
_AMPM = AMPM;
}

void Word100::setDelay(int wait) {
_wait = wait;
}
Loading

0 comments on commit a9c7084

Please sign in to comment.