Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- BlizzyB Sine Ed. - Douglas Berdeaux 2014 (C) GNU
- Firmware version 0.2 (Still in BETA)
- This project requires a lot of knowledge about SD card reading and the TMRpcm library.
- Please see WeakNetLabs.com for more details.
- - WeakNetLabs@Gmail.com
- */
- #include <SD.h> // preprocessor directives (header files)
- #define SDPIN 10 // SD Card Pin for SeeedStudio SD Card Shield
- #include <TMRpcm.h> // to play WAV files
- #include <Keypad.h> // for the keypad
- int b2600 = 14; // 2600Hz Supervisory Signalling button
- File myFile; // create objects here from library classes
- TMRpcm tmrpcm; // create sound playing object
- char keys[4][4] = { // matrix layout used by the Keypad library
- {'1','2','3','a'},
- {'4','5','6','b'},
- {'7','8','9','c'},
- {'*','0','#','d'}
- };
- byte rowPins[4] = {5,4,3,2}; //connect to the row pinouts of the keypad
- byte colPins[4] = {14,8,7,6}; //connect to the column pinouts of the keypad
- Keypad keypad = Keypad(makeKeymap(keys),rowPins,colPins,4,4);
- void setup(){
- pinMode(b2600, INPUT); // A1 2600 button
- tmrpcm.speakerPin = 9; //11 on Mega, 9 on Uno, Nano, etc
- tmrpcm.setVolume(3); // set volume here (test for distortion)
- tmrpcm.play("sounds/blusinbu.wav"); // start up sound
- delay(1000); // pause
- return;
- }
- void loop(){ // our main loop
- procButton(); // process input
- if(digitalRead(b2600)==HIGH){ // play 2600Hz if button pressed
- super(); // supervisory signalling
- }
- return;
- }
- void super(){ // this is it's own, for future expansion
- tmrpcm.play("sounds/blusin26.wav");
- return;
- }
- void procButton(void){
- char button = keypad.getKey();
- if (button){ // if a button was pressed
- int intB = button - 48; // get Blue Box element index
- if(intB>-1&&intB<10){ // 0-9
- char convert[2]; // these next few lines convert intB to char for sending
- String str; // filename string into the play method of the TMRpcm object
- str=String(intB);
- str.toCharArray(convert,2);
- char string[20] = "sounds/blusin0X.wav"; // X gets replaced
- string[14] = *convert;
- tmrpcm.play(string);
- delay(100);
- }else if(intB==-6){ // KP
- tmrpcm.play("sounds/blusinkp.wav");
- }else if(intB==-13){ // ST
- tmrpcm.play("sounds/blusinst.wav");
- }else if(intB==49){ // 2600 (Assigned to 'A' for now
- super();
- }
- }else{
- return; // no button pressed
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement