Skip to content

Commit

Permalink
Cleaned up a bit and added an ESP8266 example.
Browse files Browse the repository at this point in the history
  • Loading branch information
thirsch committed Nov 3, 2019
1 parent 957e00f commit 5686e2f
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.development

66 changes: 66 additions & 0 deletions examples/ESP8266/ESP8266.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
Example of using the WTV020SD16P chip on an ESP8266.
Connect the WTV020SD16P to your ESP8266 and define the pins below.
created 3 Nov 2019
by Thomas A. Hirsch
original version created by ELECTRONOOBS, 14 Oct 2016.
This example code is in the public domain.
*/

#include <Arduino.h>
#include <WTV020SD16P.h>

// Constants to define the used pins.
static const uint8_t resetPin = D1; // The pin number of the reset pin.
static const uint8_t clockPin = D6; // The pin number of the clock pin.
static const uint8_t dataPin = D7; // The pin number of the data pin.
static const uint8_t busyPin = D5; // The pin number of the busy pin.

// Instance of WTV020SD16P
WTV020SD16P wtv020sd16p(resetPin, clockPin,dataPin,busyPin);

void setup() {

}

void loop() {
wtv020sd16p.asyncPlayVoice(0);

////////////////////////////////////////////
//This are all the functions for the WTV020 module
//Use yours and delete the others
//Each function is explained
///////////////////////////////////////////
//Plays synchronously an audio file. Busy pin is used for this method.
//wtv020sd15p.playVoice(0); // Will triggern the wdt (watch-dog timer) due to the use of sleep() on ESP8266!
//Plays asynchronously an audio file.
//wtv020sd16p.asyncPlayVoice(1);
//Plays audio file number 1 during 5 seconds.
//wtv020sd16p.asyncPlayVoice(1);
//delay(5000);
//Pauses audio file number 1 during 5 seconds.
//wtv020sd16p.pauseVoice();
//delay(5000);
//Resumes audio file number 1 during 5 seconds.
//wtv020sd16p.pauseVoice();
//delay(5000);
//Stops current audio file playing.
//wtv020sd16p.stopVoice();
//Plays synchronously an audio file. Busy pin is used for this method.
//wtv020sd16p.asyncPlayVoice(2);
//delay(2000);
//Mutes audio file number 2 during 2 seconds.
//wtv020sd16p.mute();
//delay(2000);
//Unmutes audio file number 2 during 2 seconds.
//wtv020sd16p.unmute();
//delay(2000);
//Stops current audio file playing.
//wtv020sd16p.stopVoice();
//Resets the chip - Will initially be called during construction.
//wtv020sd16p.reset();
}
2 changes: 1 addition & 1 deletion keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#######################################
# Datatypes (KEYWORD1)
#######################################
WTV020SD16P KEYWORD1
WTV020SD16P KEYWORD1 DATA_TYPE

#######################################
# Methods and Functions (KEYWORD2)
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 5686e2f

Please sign in to comment.