SORRY ABOUT MY DOUBLE POST I DON'T KNOW HOW TO DELETE THREADS.
So I'm building a MIDI controller/Standalone Matrix with a Teensy 4.1 and an audio shield, MIDI controls FL Studio and it works, standalone just assigns a different sound to an individual button and plays it through the audio shield's RCA outputs. When trying the standalone portion by itself it works fine but when put together with the rest of my code serial prints the MCU is playing the file but there is no sound coming from it. Is it a pin assignment overlapping each other? Am I missing something on my code? Is it even possible to have both MIDI and standalone together?. Here's my code [I commented certain functions I am working on which are menus for different audio libraries and I am playing the same sound on all buttons for practicity] and attached a picture of my circuit.
So I'm building a MIDI controller/Standalone Matrix with a Teensy 4.1 and an audio shield, MIDI controls FL Studio and it works, standalone just assigns a different sound to an individual button and plays it through the audio shield's RCA outputs. When trying the standalone portion by itself it works fine but when put together with the rest of my code serial prints the MCU is playing the file but there is no sound coming from it. Is it a pin assignment overlapping each other? Am I missing something on my code? Is it even possible to have both MIDI and standalone together?. Here's my code [I commented certain functions I am working on which are menus for different audio libraries and I am playing the same sound on all buttons for practicity] and attached a picture of my circuit.
Code:
#include <LiquidCrystal.h>
#include <ResponsiveAnalogRead.h>
#include <Bounce.h>
#include <ezButton.h>
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
//////////////////////////////////////////////AUDIO PORTS
AudioPlaySdWav playWav1;
AudioOutputI2S audioOutput;
AudioConnection patchCord1(playWav1, 0, audioOutput, 0);
AudioConnection patchCord2(playWav1, 1, audioOutput, 1);
AudioControlSGTL5000 sgtl5000_1;
//////////////////////////////////////////////SD CARD INPUTS
#define SDCARD_CS_PIN BUILTIN_SDCARD
#define SDCARD_MOSI_PIN 11 // not actually used
#define SDCARD_SCK_PIN 13 // not actually used
//////////////////////////////////////////////STANDLAONE MENU
const int numberOfScreens = 6;
int currentScreen = 0;
String screens[numberOfScreens][3] = {{"RAP","OK","NEXT"}, {"R&B","OK","NEXT"},
{"HOUSE","OK","NEXT"},{"TECHNO","OK","NEXT"}, {"MOOMBAHATON","OK","NEXT"}, {"REGGAETON","OK","NEXT"}};
int parameters[numberOfScreens];
/////////////////////////////////////////////MIDI CHANNEL SELECT
const int channel = 0;
///////////////////////////////////////////// LCD
const int rs = 12;
const int en = 11;
const int d4 = 9;
const int d5 = 8;
const int d6 = 7;
const int d7 = 6;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
///////////////////////////////////////////// MENU BUTTONS
const int ok = 30;
const int next = 29;
const int prev = 28;
ezButton button30(ok);
ezButton button29(next);
ezButton button28(prev);
int okFlag = 0;
int backFlag = 0;
int toggleFlag = 0;
///////////////////////////////////////////// ANALOG INPUTS
const int A_PINS = 12;
const int ANALOG_PINS[A_PINS] = {A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11};
const int CCID[A_PINS] = {21, 22, 23, 24, 25, 26, 27, 28, 29 , 30, 31, 32};
byte data [A_PINS];
byte dataLag[A_PINS];
ResponsiveAnalogRead analog []{
{ANALOG_PINS[0],true},
{ANALOG_PINS[1],true},
{ANALOG_PINS[2],true},
{ANALOG_PINS[3],true},
{ANALOG_PINS[4],true},
{ANALOG_PINS[5],true},
{ANALOG_PINS[6],true},
{ANALOG_PINS[7],true},
{ANALOG_PINS[8],true},
{ANALOG_PINS[9],true},
{ANALOG_PINS[10],true},
{ANALOG_PINS[11],true},
};
///////////////////////////////////////////// DIGITAL INPUTS
Bounce button0 = Bounce(0, 5);
Bounce button1 = Bounce(1, 5);
Bounce button2 = Bounce(2, 5);
Bounce button3 = Bounce(3, 5);
Bounce button4 = Bounce(4, 5);
Bounce button5 = Bounce(5, 5);
Bounce button6 = Bounce(6, 5);
Bounce button7 = Bounce(7, 5);
Bounce button8 = Bounce(8, 5);
Bounce button9 = Bounce(9, 5);
Bounce button10 = Bounce(10, 5);
Bounce button11 = Bounce(11, 5);
Bounce button12 = Bounce(12, 5);
Bounce button13 = Bounce(13, 5);
Bounce button14 = Bounce(14, 5);
Bounce button15 = Bounce(15, 5);
//////////////////////////////// CHANNEL BUTTONS
const int ch1 = 34;
const int ch2 = 35;
const int ch3 = 36;
const int ch4 = 37;
Bounce button16 = Bounce(16, 5);
Bounce button17 = Bounce(17, 5);
Bounce button18 = Bounce(18, 5);
Bounce button19 = Bounce(19, 5);
int b16 = 0;
int b17 = 0;
int b18 = 0;
int b19 = 0;
//////////////////////////////// MULTIPLEXER VARIABLE DECLARATION
const int s0 = 1;
const int s1 = 2;
const int s2 = 3;
const int s3 = 4;
int bc;
int b0 = 0;
int b1 = 0;
int b2 = 0;
int b3 = 0;
int b4 = 0;
int b5 = 0;
int b6 = 0;
int b7 = 0;
int b8 = 0;
int b9 = 0;
int b10 = 0;
int b11 = 0;
int b12 = 0;
int b13 = 0;
int b14 = 0;
int b15 = 0;
void setup() {
//////////////////////////////////////////////SD CARD STARTUP
Serial.begin(9600);
AudioMemory(8);
SPI.setMOSI(SDCARD_MOSI_PIN);
SPI.setSCK(SDCARD_SCK_PIN);
if (!(SD.begin(SDCARD_CS_PIN))) {
// stop here, but print a message repetitively
while (1) {
Serial.println("Unable to access the SD card");
delay(500);
}
}
sgtl5000_1.enable();
sgtl5000_1.volume(1.0);
///////////////////////////////////////////// PIN ASSIGNMENT
pinMode(34, INPUT_PULLUP);
pinMode(35, INPUT_PULLUP);
pinMode(36, INPUT_PULLUP);
pinMode(37, INPUT_PULLUP);
pinMode(28, INPUT_PULLUP);
pinMode(29, INPUT_PULLUP);
pinMode(30, INPUT_PULLUP);
pinMode(1, OUTPUT);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, INPUT_PULLUP);
///////////////////////////////////////////// LCD STARTUP
lcd.begin(16, 2);
lcd.clear();
lcd.setCursor(6, 0);
lcd.print("MIDI");
lcd.setCursor(3, 1);
lcd.print("CONTROLLER");
delay(5000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Press OK");
lcd.setCursor(0, 1);
lcd.print("For MIDI Mode");
delay(3000);
lcd.clear();
}
//////////////////////////////////////////////
void playFile(const char *filename)
{
Serial.print("Playing file: ");
Serial.println(filename);
playWav1.play(filename);
delay(25);
}
///////////////////////////////////////////// MENU SELECTION
void loop() {
button30.loop();
if(button30.isPressed()){
lcd.clear();
lcd.setCursor(3, 0);
lcd.print("MIDI MODE");
delay(3000);
lcd.clear();
okFlag = 1;
}
if(okFlag == 1){
analogPins();
digitalPins();
chButtons();
while (usbMIDI.read()) {
}
}
else if(okFlag == 0)
{
delay(50);
standMatrix();
//inputAction();
//parameterChange();
//printMenu();
}
}
///////////////////////////////////////////// ANALOG CONTROL
void analogPins() {
for (int i=0; i<A_PINS; i++)
{
analog[i].update();
if(analog[i].hasChanged()){
data[i] = analog[i].getValue()>>3;
if(data[i] != dataLag[i]){
dataLag[i] = data[i];
usbMIDI.sendControlChange(CCID[i], data[i], channel);
lcd.clear();
lcd.setCursor(0, 1);
lcd.print(CCID[i]);
lcd.setCursor(3, 1);
lcd.print(data[i]);
}
}
}
}
///////////////////////////////////////////// DIGITAL MULTIPLEXER CONTROL
void digitalPins(){
///////////////////////////////////////////// C0 ADDRESS
digitalWrite(s0, LOW);
digitalWrite(s1, LOW);
digitalWrite(s2, LOW);
digitalWrite(s3, LOW);
delayMicroseconds(50);
button0.update();
bc = digitalRead(5);
if (bc == LOW) {
if( b0 == LOW){
b0 = HIGH;
usbMIDI.sendNoteOn(60, 99, 0); // 60 = C4
lcd.setCursor(12, 1);
lcd.print("B0");
}
}else if (bc == HIGH){
if(b0 == HIGH){
b0 = LOW;
lcd.setCursor(12, 1);
lcd.print(" ");
}
}
///////////////////////////////////////////// C1 ADDRESS
digitalWrite(s0, HIGH);
digitalWrite(s1, LOW);
digitalWrite(s2, LOW);
digitalWrite(s3, LOW);
delayMicroseconds(50);
button1.update();
bc = digitalRead(5);
if (bc == LOW) {
if( b1 == LOW){
b1 = HIGH;
usbMIDI.sendNoteOn(61, 99, 0);
lcd.setCursor(12, 1);
lcd.print("B1");
}
}else if (bc == HIGH){
if(b1 == HIGH){
b1 = LOW;
lcd.setCursor(12, 1);
lcd.print(" ");
}
}
//////////////////////////////////////////////////// C2 ADDRESS
digitalWrite(s0, LOW);
digitalWrite(s1, HIGH);
digitalWrite(s2, LOW);
digitalWrite(s3, LOW);
delayMicroseconds(50);
button2.update();
bc = digitalRead(5);
if (bc == LOW) {
if( b2 == LOW){
b2 = HIGH;
usbMIDI.sendNoteOn(62, 99, 0);
lcd.setCursor(12, 1);
lcd.print("B2");
}
}else if (bc == HIGH){
if(b2 == HIGH){
b2 = LOW;
lcd.setCursor(12, 1);
lcd.print(" ");
}
}
////////////////////////////////////////////////////// C3 ADDRESS
digitalWrite(s0, HIGH);
digitalWrite(s1, HIGH);
digitalWrite(s2, LOW);
digitalWrite(s3, LOW);
delayMicroseconds(50);
button3.update();
bc = digitalRead(5);
if (bc == LOW) {
if( b3 == LOW){
b3 = HIGH;
usbMIDI.sendNoteOn(63, 99, 0);
lcd.setCursor(12, 1);
lcd.print("B3");
}
}else if (bc == HIGH){
if(b3 == HIGH){
b3 = LOW;
lcd.setCursor(12, 1);
lcd.print(" ");
}
}
////////////////////////////////////////////////////// C4 ADDRESS
digitalWrite(s0, LOW);
digitalWrite(s1, LOW);
digitalWrite(s2, HIGH);
digitalWrite(s3, LOW);
delayMicroseconds(50);
button4.update();
bc = digitalRead(5);
if (bc == LOW) {
if( b4 == LOW){
b4 = HIGH;
usbMIDI.sendNoteOn(64, 99, 0);
lcd.setCursor(12, 1);
lcd.print("B4");
}
}else if (bc == HIGH){
if(b4 == HIGH){
b4 = LOW;
lcd.setCursor(12, 1);
lcd.print(" ");
}
}
////////////////////////////////////////////////////// C5 ADDRESS
digitalWrite(s0, HIGH);
digitalWrite(s1, LOW);
digitalWrite(s2, HIGH);
digitalWrite(s3, LOW);
delayMicroseconds(50);
button5.update();
bc = digitalRead(5);
if (bc == LOW) {
if( b5 == LOW){
b5 = HIGH;
usbMIDI.sendNoteOn(65, 99, 0);
lcd.setCursor(12, 1);
lcd.print("B5");
}
}else if (bc == HIGH){
if(b5 == HIGH){
b5 = LOW;
lcd.setCursor(12, 1);
lcd.print(" ");
}
}
////////////////////////////////////////////////////// C6 ADDRESS
digitalWrite(s0, LOW);
digitalWrite(s1, HIGH);
digitalWrite(s2, HIGH);
digitalWrite(s3, LOW);
delayMicroseconds(50);
button6.update();
bc = digitalRead(5);
if (bc == LOW) {
if( b6 == LOW){
b6 = HIGH;
usbMIDI.sendNoteOn(66, 99, 0);
lcd.setCursor(12, 1);
lcd.print("B6");
}
}else if (bc == HIGH){
if(b6 == HIGH){
b6 = LOW;
lcd.setCursor(12, 1);
lcd.print(" ");
}
}
////////////////////////////////////////////////////// C7 ADDRESS
digitalWrite(s0, HIGH);
digitalWrite(s1, HIGH);
digitalWrite(s2, HIGH);
digitalWrite(s3, LOW);
delayMicroseconds(50);
button7.update();
bc = digitalRead(5);
if (bc == LOW) {
if( b7 == LOW){
b7 = HIGH;
usbMIDI.sendNoteOn(67, 99, 0);
lcd.setCursor(12, 1);
lcd.print("B7");
}
}else if (bc == HIGH){
if(b7 == HIGH){
b7 = LOW;
lcd.setCursor(12, 1);
lcd.print(" ");
}
}
////////////////////////////////////////////////////// C8 ADDRESS
digitalWrite(s0, LOW);
digitalWrite(s1, LOW);
digitalWrite(s2, LOW);
digitalWrite(s3, HIGH);
delayMicroseconds(50);
button8.update();
bc = digitalRead(5);
if (bc == LOW) {
if( b8 == LOW){
b8 = HIGH;
usbMIDI.sendNoteOn(68, 99, 0);
lcd.setCursor(12, 1);
lcd.print("B8");
}
}else if (bc == HIGH){
if(b8 == HIGH){
b8 = LOW;
lcd.setCursor(12, 1);
lcd.print(" ");
}
}
///////////////////////////////////////////// C9 ADDRESS
digitalWrite(s0, HIGH);
digitalWrite(s1, LOW);
digitalWrite(s2, LOW);
digitalWrite(s3, HIGH);
delayMicroseconds(50);
button9.update();
bc = digitalRead(5);
if (bc == LOW) {
if( b9 == LOW){
b9 = HIGH;
usbMIDI.sendNoteOn(69, 99, 0);
lcd.setCursor(12, 1);
lcd.print("B9");
}
}else if (bc == HIGH){
if(b9 == HIGH){
b9 = LOW;
lcd.setCursor(12, 1);
lcd.print(" ");
}
}
//////////////////////////////////////////////////// C10 ADDRESS
digitalWrite(s0, LOW);
digitalWrite(s1, HIGH);
digitalWrite(s2, LOW);
digitalWrite(s3, HIGH);
delayMicroseconds(50);
button10.update();
bc = digitalRead(5);
if (bc == LOW) {
if( b10 == LOW){
b10 = HIGH;
usbMIDI.sendNoteOn(70, 99, 0);
lcd.setCursor(12, 1);
lcd.print("B10");
}
}else if (bc == HIGH){
if(b10 == HIGH){
b10 = LOW;
lcd.setCursor(12, 1);
lcd.print(" ");
}
}
////////////////////////////////////////////////////// C11 ADDRESS
digitalWrite(s0, HIGH);
digitalWrite(s1, HIGH);
digitalWrite(s2, LOW);
digitalWrite(s3, HIGH);
delayMicroseconds(50);
button11.update();
bc = digitalRead(5);
if (bc == LOW) {
if( b11 == LOW){
b11 = HIGH;
usbMIDI.sendNoteOn(71, 99, 0);
lcd.setCursor(12, 1);
lcd.print("B11");
}
}else if (bc == HIGH){
if(b11 == HIGH){
b11 = LOW;
lcd.setCursor(12, 1);
lcd.print(" ");
}
}
////////////////////////////////////////////////////// C12 ADDRESS
digitalWrite(s0, LOW);
digitalWrite(s1, LOW);
digitalWrite(s2, HIGH);
digitalWrite(s3, HIGH);
delayMicroseconds(50);
button12.update();
bc = digitalRead(5);
if (bc == LOW) {
if( b12 == LOW){
b12 = HIGH;
usbMIDI.sendNoteOn(72, 99, 0);
lcd.setCursor(12, 1);
lcd.print("B12");
}
}else if (bc == HIGH){
if(b12 == HIGH){
b12 = LOW;
lcd.setCursor(12, 1);
lcd.print(" ");
}
}
////////////////////////////////////////////////////// C13 ADDRESS
digitalWrite(s0, HIGH);
digitalWrite(s1, LOW);
digitalWrite(s2, HIGH);
digitalWrite(s3, HIGH);
delayMicroseconds(50);
button13.update();
bc = digitalRead(5);
if (bc == LOW) {
if( b13 == LOW){
b13 = HIGH;
usbMIDI.sendNoteOn(73, 99, 0);
lcd.setCursor(12, 1);
lcd.print("B13");
}
}else if (bc == HIGH){
if(b13 == HIGH){
b13 = LOW;
lcd.setCursor(12, 1);
lcd.print(" ");
}
}
////////////////////////////////////////////////////// C14 ADDRESS
digitalWrite(s0, LOW);
digitalWrite(s1, HIGH);
digitalWrite(s2, HIGH);
digitalWrite(s3, HIGH);
delayMicroseconds(50);
button14.update();
bc = digitalRead(5);
if (bc == LOW) {
if( b14 == LOW){
b14 = HIGH;
usbMIDI.sendNoteOn(74, 99, 0);
lcd.setCursor(12, 1);
lcd.print("B14");
}
}else if (bc == HIGH){
if(b14 == HIGH){
b14 = LOW;
lcd.setCursor(12, 1);
lcd.print(" ");
}
}
////////////////////////////////////////////////////// C15 ADDRESS
digitalWrite(s0, HIGH);
digitalWrite(s1, HIGH);
digitalWrite(s2, HIGH);
digitalWrite(s3, HIGH);
delayMicroseconds(50);
button15.update();
bc = digitalRead(5);
if (bc == LOW) {
if( b15 == LOW){
b15 = HIGH;
usbMIDI.sendNoteOn(75, 99, 0);
lcd.setCursor(12, 1);
lcd.print("B15");
}
}else if (bc == HIGH){
if(b15 == HIGH){
b15 = LOW;
lcd.setCursor(12, 1);
lcd.print(" ");
}
}
}
///////////////////////////////////////////// CHANNEL BUTTON CONTROL
void chButtons(){
////////////////////////////////////////////////////// CH1 ADDRESS
button16.update();
bc = digitalRead(34);
if (bc == LOW) {
if( b16 == LOW){
b16 = HIGH;
usbMIDI.sendNoteOn(76, 99, 0);
lcd.setCursor(7, 1);
lcd.print("CH1");
}
}else if (bc == HIGH){
if(b16 == HIGH){
b16 = LOW;
lcd.setCursor(7, 1);
lcd.print(" ");
}
}
///////////////////////////////////////////////////// CH2 ADDRESS
button17.update();
bc = digitalRead(35);
if (bc == LOW) {
if( b17 == LOW){
b17 = HIGH;
usbMIDI.sendNoteOn(77, 99, 0);
lcd.setCursor(7, 1);
lcd.print("CH2");
}
}else if (bc == HIGH){
if(b17 == HIGH){
b17 = LOW;
lcd.setCursor(7, 1);
lcd.print(" ");
}
}
///////////////////////////////////////////////////// CH3 ADDRESS
button18.update();
bc = digitalRead(36);
if (bc == LOW) {
if( b18 == LOW){
b18 = HIGH;
usbMIDI.sendNoteOn(78, 99, 0);
lcd.setCursor(7, 1);
lcd.print("CH3");
}
}else if (bc == HIGH){
if(b18 == HIGH){
b18 = LOW;
lcd.setCursor(7, 1);
lcd.print(" ");
}
}
///////////////////////////////////////////////////// CH4 ADDRESS
button19.update();
bc = digitalRead(37);
if (bc == LOW) {
if( b19 == LOW){
b19 = HIGH;
usbMIDI.sendNoteOn(79, 99, 0);
lcd.setCursor(7, 1);
lcd.print("CH4");
}
}else if (bc == HIGH){
if(b19 == HIGH){
b19 = LOW;
lcd.setCursor(7, 1);
lcd.print(" ");
}
}
}
/////////////////////////////////////////////MENU SELECTION
void inputAction()
{
button28.loop();
if(button28.isPressed()){
if (currentScreen == 0){
currentScreen = numberOfScreens-1;
}else{
currentScreen--;
}
}
}
/////////////////////////////////////////////MENU LOAD
/*
void parameterChange()
{
button29.loop();
if(button29.isPressed())
{
//parameters[currentScreen] = 1;
//openLibrary(currentScreen);
playFile("SOUL.WAV");
}
}
*/
/////////////////////////////////////////////MENU PRINTING
/*
void printMenu()
{
lcd.clear();
lcd.print(screens[currentScreen][0]);
lcd.setCursor(0, 1);
lcd.print(screens[currentScreen][1]);
lcd.setCursor(12, 1);
lcd.print(screens[currentScreen][2]);
lcd.setCursor(8,1);
lcd.print(parameters[currentScreen]);
}
*/
/////////////////////////////////////////////LIBRARY SELECTION
/*
void openLibrary(int choice)
{
if (choice == 1)
{
playFile("SOUL.WAV");
delay(500);
}
}
*/
/////////////////////////////////////////////
void standMatrix(){
///////////////////////////////////////////// C0 ADDRESS
digitalWrite(s0, LOW);
digitalWrite(s1, LOW);
digitalWrite(s2, LOW);
digitalWrite(s3, LOW);
delayMicroseconds(50);
button0.update();
bc = digitalRead(5);
if (bc == LOW) {
if( b0 == LOW){
b0 = HIGH;
playFile("SOUL.WAV");
}
}else if (bc == HIGH){
if(b0 == HIGH){
b0 = LOW;
}
}
///////////////////////////////////////////// C1 ADDRESS
digitalWrite(s0, HIGH);
digitalWrite(s1, LOW);
digitalWrite(s2, LOW);
digitalWrite(s3, LOW);
delayMicroseconds(50);
button1.update();
bc = digitalRead(5);
if (bc == LOW) {
if( b1 == LOW){
b1 = HIGH;
playFile("SOUL.WAV");
}
}else if (bc == HIGH){
if(b1 == HIGH){
b1 = LOW;
}
}
//////////////////////////////////////////////////// C2 ADDRESS
digitalWrite(s0, LOW);
digitalWrite(s1, HIGH);
digitalWrite(s2, LOW);
digitalWrite(s3, LOW);
delayMicroseconds(50);
button2.update();
bc = digitalRead(5);
if (bc == LOW) {
if( b2 == LOW){
b2 = HIGH;
playFile("SOUL.WAV");
}
}else if (bc == HIGH){
if(b2 == HIGH){
b2 = LOW;
}
}
////////////////////////////////////////////////////// C3 ADDRESS
digitalWrite(s0, HIGH);
digitalWrite(s1, HIGH);
digitalWrite(s2, LOW);
digitalWrite(s3, LOW);
delayMicroseconds(50);
button3.update();
bc = digitalRead(5);
if (bc == LOW) {
if( b3 == LOW){
b3 = HIGH;
playFile("SOUL.WAV");
}
}else if (bc == HIGH){
if(b3 == HIGH){
b3 = LOW;
}
}
////////////////////////////////////////////////////// C4 ADDRESS
digitalWrite(s0, LOW);
digitalWrite(s1, LOW);
digitalWrite(s2, HIGH);
digitalWrite(s3, LOW);
delayMicroseconds(50);
button4.update();
bc = digitalRead(5);
if (bc == LOW) {
if( b4 == LOW){
b4 = HIGH;
playFile("SOUL.WAV");
}
}else if (bc == HIGH){
if(b4 == HIGH){
b4 = LOW;
}
}
////////////////////////////////////////////////////// C5 ADDRESS
digitalWrite(s0, HIGH);
digitalWrite(s1, LOW);
digitalWrite(s2, HIGH);
digitalWrite(s3, LOW);
delayMicroseconds(50);
button5.update();
bc = digitalRead(5);
if (bc == LOW) {
if( b5 == LOW){
b5 = HIGH;
playFile("SOUL.WAV");
}
}else if (bc == HIGH){
if(b5 == HIGH){
b5 = LOW;
}
}
////////////////////////////////////////////////////// C6 ADDRESS
digitalWrite(s0, LOW);
digitalWrite(s1, HIGH);
digitalWrite(s2, HIGH);
digitalWrite(s3, LOW);
delayMicroseconds(50);
button6.update();
bc = digitalRead(5);
if (bc == LOW) {
if( b6 == LOW){
b6 = HIGH;
playFile("SOUL.WAV");
}
}else if (bc == HIGH){
if(b6 == HIGH){
b6 = LOW;
}
}
////////////////////////////////////////////////////// C7 ADDRESS
digitalWrite(s0, HIGH);
digitalWrite(s1, HIGH);
digitalWrite(s2, HIGH);
digitalWrite(s3, LOW);
delayMicroseconds(50);
button7.update();
bc = digitalRead(5);
if (bc == LOW) {
if( b7 == LOW){
b7 = HIGH;
playFile("SOUL.WAV");
}
}else if (bc == HIGH){
if(b7 == HIGH){
b7 = LOW;
}
}
////////////////////////////////////////////////////// C8 ADDRESS
digitalWrite(s0, LOW);
digitalWrite(s1, LOW);
digitalWrite(s2, LOW);
digitalWrite(s3, HIGH);
delayMicroseconds(50);
button8.update();
bc = digitalRead(5);
if (bc == LOW) {
if( b8 == LOW){
b8 = HIGH;
playFile("SOUL.WAV");
}
}else if (bc == HIGH){
if(b8 == HIGH){
b8 = LOW;
}
}
///////////////////////////////////////////// C9 ADDRESS
digitalWrite(s0, HIGH);
digitalWrite(s1, LOW);
digitalWrite(s2, LOW);
digitalWrite(s3, HIGH);
delayMicroseconds(50);
button9.update();
bc = digitalRead(5);
if (bc == LOW) {
if( b9 == LOW){
b9 = HIGH;
playFile("SOUL.WAV");
}
}else if (bc == HIGH){
if(b9 == HIGH){
b9 = LOW;
}
}
//////////////////////////////////////////////////// C10 ADDRESS
digitalWrite(s0, LOW);
digitalWrite(s1, HIGH);
digitalWrite(s2, LOW);
digitalWrite(s3, HIGH);
delayMicroseconds(50);
button10.update();
bc = digitalRead(5);
if (bc == LOW) {
if( b10 == LOW){
b10 = HIGH;
playFile("SOUL.WAV");
}
}else if (bc == HIGH){
if(b10 == HIGH){
b10 = LOW;
}
}
////////////////////////////////////////////////////// C11 ADDRESS
digitalWrite(s0, HIGH);
digitalWrite(s1, HIGH);
digitalWrite(s2, LOW);
digitalWrite(s3, HIGH);
delayMicroseconds(50);
button11.update();
bc = digitalRead(5);
if (bc == LOW) {
if( b11 == LOW){
b11 = HIGH;
playFile("SOUL.WAV");
}
}else if (bc == HIGH){
if(b11 == HIGH){
b11 = LOW;
}
}
////////////////////////////////////////////////////// C12 ADDRESS
digitalWrite(s0, LOW);
digitalWrite(s1, LOW);
digitalWrite(s2, HIGH);
digitalWrite(s3, HIGH);
delayMicroseconds(50);
button12.update();
bc = digitalRead(5);
if (bc == LOW) {
if( b12 == LOW){
b12 = HIGH;
playFile("SOUL.WAV");
}
}else if (bc == HIGH){
if(b12 == HIGH){
b12 = LOW;
}
}
////////////////////////////////////////////////////// C13 ADDRESS
digitalWrite(s0, HIGH);
digitalWrite(s1, LOW);
digitalWrite(s2, HIGH);
digitalWrite(s3, HIGH);
delayMicroseconds(50);
button13.update();
bc = digitalRead(5);
if (bc == LOW) {
if( b13 == LOW){
b13 = HIGH;
playFile("SOUL.WAV");
}
}else if (bc == HIGH){
if(b13 == HIGH){
b13 = LOW;
}
}
////////////////////////////////////////////////////// C14 ADDRESS
digitalWrite(s0, LOW);
digitalWrite(s1, HIGH);
digitalWrite(s2, HIGH);
digitalWrite(s3, HIGH);
delayMicroseconds(50);
button14.update();
bc = digitalRead(5);
if (bc == LOW) {
if( b14 == LOW){
b14 = HIGH;
playFile("SOUL.WAV");
}
}else if (bc == HIGH){
if(b14 == HIGH){
b14 = LOW;
}
}
////////////////////////////////////////////////////// C15 ADDRESS
digitalWrite(s0, HIGH);
digitalWrite(s1, HIGH);
digitalWrite(s2, HIGH);
digitalWrite(s3, HIGH);
delayMicroseconds(50);
button15.update();
bc = digitalRead(5);
if (bc == LOW) {
if( b15 == LOW){
b15 = HIGH;
playFile("SOUL.WAV");
}
}else if (bc == HIGH){
if(b15 == HIGH){
b15 = LOW;
}
}
}
Last edited by a moderator: