Loading multiple files onto ATmega328 for a Bleep Drum clone

Hello,

I'm trying to make a Bleep Labs Bleep Drum Clone. I have all the components and the schematic, and an ATmega328 chip from an Arduino Duemilanove, I'm just a bit loss as to how to load the Bleep Drum code onto the chip.

Here's a link to the Bleep Drum site for info about the project:
http://bleeplabs.com/bleep-drum-user-guide/

I'm using the following code:
http://bleeplabs.com/bd_inst_sf/Bleep%20Brum%20code%20v003.zip

The zip folder above shows multiple sketch files for different parts of its operation, not one sketch file with different tabs.
I've never loaded more than a simple one file, one tab instruction onto an Arduino, but I was hoping that once the code is on the chip, this would be fairly strait forward project, since the code is already written by the rad dudes over at Bleep Labs.

I've read a bit about loading multiple tabs into one sketch file, but I am sure I'm thinking about it wrong.

Could anyone shed some light on how I should be approaching this?

Also, once I'm ready to interface, can I simply load it using the Duemilanove, remove the chip, and place it right in my cloned Bleep Drum?

Thanks for your help everyone!

Josh

Hello,

I'm trying to make a Bleep Labs: Bleep Drum Clone. I have all the components and the schematic, and an ATmega328 chip from an Arduino Duemilanove, I'm just a bit loss as to how to load the Bleep Drum code onto the chip.

Here's a link to the Bleep Drum site for info about the project:
http://bleeplabs.com/bleep-drum-user-guide/

I'm using the following code:
http://bleeplabs.com/bd_inst_sf/Bleep%20Brum%20code%20v003.zip

The zip folder above shows multiple sketch files for different parts of its operation, not one sketch file with different tabs.
I've never loaded more than a simple one file, one tab instruction onto an Arduino, but I was hoping that once the code is on the chip, this would be fairly strait forward project, since the code is already written by the rad dudes over at Bleep Labs.

I've read a bit about loading multiple tabs into one sketch file, but I am sure I'm thinking about it wrong.

Could anyone shed some light on how I should be approaching this?

Also, once I'm ready to interface, can I simply load it using the Duemilanove, remove the chip, and place it right in my cloned Bleep Drum?

Thanks for your help everyone!

Josh

*I may have previously posted this the wrong forum so I'm posting it here.

The answer to your thread title is that you can't. But, that is not the question that you asked in the body.

Unzip the files into a folder in your sketch directory. The folder should probably be called BLEEP_DRUM_003.

When you verify a sketch, the IDE combines all the .ino files into one .cpp file to be compiled.

Put all the files into a folder called
BLEEP_DRUM_003
then open BLEEP_DRUM_003 from the IDE, I think all the files will show up as Tabs next to the main BLEEP_DRUM_003 tab.

If that compiles okay, then I'd say yes to the rest of your question, assuming bleep drum hardware is similar to Uno.

Hey, thanks guys for the explanation,

I'm able to open the project into tabs, but when I try to compile I get the message attached below.

I'm assuming the code is correct since it's provided by Bleep Labs, and that it simply was not designed to be run on an arduino?

Any thoughts on how to get this code uploaded to the 328 chip?

Thanks again!
Josh

Seems like you are missing the DACMCP49xx library, or it is not installed in you libraries folder.

I think I understand what's wrong, I'm just not sure I know how to fix it.
I get that the DAC needs a library, but I don't exactly know what that is and how it's properly used. I'm assuming some specific code designed to interface with that specific chip?

I've searched for libraries that I can load and have found two:

and
http://happyrobotlabs.com/posts/project/artemis-synthesizer-2-interfacing-with-the-mcp4921-spi-dac/

I tried installing them both, but still get the same error as previously posted. I also tried renaming the library to "DAC_MCP49xx" to match the one highlighted in the error message, but no dice.

Sorry for asking for more explanation, I just feel like this might just be a simple that I'm unfamiliar with.

Any explanation of what the trouble I'm encountering is would be greatly appreciated!!

Thanks so much.
Josh

You're using an MCP49xx DAC?
MCP4901, 4902, 4911, 4912, 4921, 4922?
(differences are 8-10-12-14 bit, single or dual, and built in Vref or not I think)
http://www.digikey.com/product-search/en/integrated-circuits-ics/data-acquisition-digital-to-analog-converters-dac/2556292?k=mcp%2049%20dac
They are easy to use - just do your own 1 and 2 byte SPI.transfer()s to them,

digitalWrite(chipSelect, LOW);
SPI.transfer(upperByte);  // this one usually includes a few configuration bits
SPI.transfer(lowerByte);
digitalWrite (chipSelect, HIGH);

If you include all of your sketch - CTRL-A to highlight it, CTRL-C to copy, then paste in here with code /code tags - and all of the error message (same process I think), we can advise on the other things.

Hey guys,
Thanks again for your help, I can copy the code from the main sketch file and paste it here. It's pretty long though, I removed most of all the "sound" sequence numbers so my post would fit I hope it makes sense:

#include <avr/pgmspace.h>
#include <SPI.h>
#include <Bounce.h>
#include <DAC_MCP49xx.h>

DAC_MCP49xx dac(DAC_MCP49xx::MCP4901, 10);

PROGMEM prog_char noise_table[] = {};

PROGMEM prog_char kick_table[] =
{
127,127,127,127,127,127,127,127,127,127,127,127,127,
};
int kick_length=5744;

PROGMEM prog_char tick_table[] =

{
127,128,127,126,125,124,124,123,124,

};
int tick_length=832;

PROGMEM prog_char snare_table[] = //clap

{
127,129,125,130,124,131,121,134,114,178,222,

};

int snare_length= 5200;

PROGMEM prog_char bass_table[] =
//button2 tom
{
127,137,146,153,154,156,163,170,175,
};
int bass_length=12150;
int sample_holder1,sample_holder2;
byte eee,ee,ef,eef;
byte shift,bankpg,bankpr,bout,rout,gout,prevpot2;
byte banko=0;
byte n1,n2;
int n3;
byte bankpb=4;
byte beat;
int pot1 = 127;
int pot2=4;
long pot3,pot4;
int kick_sample,snare_sample,sample,hat_sample,noise_sample,bass_sample,B2_freq_sample,B1_freq_sample;
uint16_t increment,increment2,increment3,increment4,increment5,increment2v,increment4v;
uint32_t accumulator,accumulator2,accumulator3,accumulator4,accumulator5,accu_freq_1,accu_freq_2;
int rando;
//byte B1_sequence[16]={0,1,0,1 ,1,1,0,0 ,0,1,0,1 ,1,1,1,1};
//byte B4_sequence[16]={1,0,1,0 ,1,0,1,0 ,1,0,1,0 ,1,1,1,1};
byte B2_sequence[128]={};
byte B3_sequence[128]={};
byte B1_sequence[128]={};
byte B4_sequence[128]={
1,0,0,0 ,0,0,0,0 ,1,0,0,0 ,0,0,0,0 ,1,0,0,0 ,0,0,0,0 ,1,0,0,0 ,0,0,0,0,
1,0,0,0 ,0,0,0,0 ,1,0,0,0 ,0,0,0,0 ,1,0,0,0 ,0,0,0,0 ,1,0,0,0 ,0,0,0,0,
0,0,0,0 ,0,0,0,0 ,0,0,0,0 ,0,0,0,0 ,0,0,0,0 ,0,0,0,0 ,0,0,0,0 ,0,0,0,0,
1,1,1,1 ,1,1,1,1 ,1,1,1,1 ,1,1,1,1 ,0,0,0,0 ,0,0,0,0 ,0,0,0,0 ,0,0,0,0,
};

int B2_freq_sequence[128]={};
int B1_freq_sequence[128]={};
int sample_sum;
int j,k,freq3,cc;
int kf,pf,holdkf,kfe;
int shiftcount=0;
int t1,c1,count1,dd;
byte noise_type;
uint16_t index,index2,index3,index4,index5,index4b,index_freq_1,index_freq_2,index4bv;
uint16_t indexr,index2r,index3r,index4r,index4br,index2vr,index4vr;
int osc,oscc;
byte ledstep;
byte noise_mode=1;
unsigned long freq,freq2;

int wavepot,lfopot, arppot;

byte loopstep=0;
byte loopstepf=0;

byte recordbutton,prevrecordbutton,record,looptrigger,prevloopstep,revbutton,prevrevbutton,preva,prevb;
int looprate;
int clapbank[16]={1,0,0,0,1,0,1,0,1,1,1,1,0,0,0,0};
long prev,prev2,prev3;
byte playmode=1;
byte play=0;
byte playbutton,pplaybutton;
byte prevbanktrigger,banktrigger;
byte pkbutton,kbutton,B4_trigger,B4_latch,cbutton, pcbutton,B4_loop_trigger, B1_trigger,kick,B1_latch,clap,B1_loop_trigger,B4_seq_trigger,B3_seq_trigger;
byte ptbutton,tbutton,ttriger,B1_seq_trigger,B3_latch,B2_trigger,bc, B2_loop_trigger,B3_loop_trigger;
byte B2_latch,B3_trigger, B2_seq_trigger,pbutton,ppbutton;
byte kicktriggerv,B2_seq_latch,kickseqtriggerv, B1_seq_latch, pewseqtriggerv,precordbutton;
byte measure,half;
byte recordmode=1;
byte tap,tapbutton,ptapbutton,eigth;
long tapholder,prevtap;
unsigned long taptempo=8000000;
unsigned long ratepot;
byte r,g,b,erase,e,preveigth;
Bounce bouncertap = Bounce(8, 15);
byte trigger_input, trigger_output, prev_trigger_in_read,trigger_in_read,trigger_out_latch,tl;
byte onetime=1;
Bounce bouncer1 = Bounce(2, 2000); //not actuall 1 seconds since timers are running at 64kHz.
Bounce bouncer4 = Bounce(18, 2000);
Bounce bouncer2 = Bounce(19, 2000);
Bounce bouncer3 = Bounce( 17, 2000);

byte prevshift,shift_latch;

byte t;
long tapbank[4];
int what,pwhat;
void setup() {
dac.setGain(1);

analogWrite(9,2); //Blue

randomSeed(analogRead(0));
//Serial.begin(9600);
cli();

pinMode (12, OUTPUT); pinMode (13, OUTPUT);pinMode (11, OUTPUT);pinMode (10, OUTPUT);pinMode (9, OUTPUT); pinMode (5, OUTPUT); pinMode (6, OUTPUT);

pinMode (3, INPUT); digitalWrite(3, HIGH); //play
pinMode (4, INPUT); digitalWrite (4, HIGH); //rec
pinMode (8, INPUT); digitalWrite (8, HIGH); //tap
pinMode (7, INPUT); digitalWrite(7, HIGH); //shift

pinMode (17, INPUT); digitalWrite (17, HIGH); //up right tom
pinMode (18, INPUT); digitalWrite (18, HIGH); // low right kick
pinMode (19, INPUT); digitalWrite (19, HIGH); //Low left clap
pinMode (2, INPUT); digitalWrite (2, HIGH); // Up left pew

pinMode (16, INPUT); digitalWrite (16, HIGH);

SPI.begin();
SPI.setBitOrder(MSBFIRST);
/* Enable interrupt on timer2 == 127, with clk/8 prescaler. At 16MHz,
this gives a timer interrupt at 15625Hz. */
TIMSK2 = (1 << OCIE2A);
OCR2A = 127;
//OCR2B = 127;

/* clear/reset timer on match /
TCCR2A = 1<<WGM21 | 0<<WGM20; /
CTC mode, reset on match /
TCCR2B = 0<<CS22 | 1<<CS21 | 1<<CS20; /
clk, /8 prescaler */

//dac
SPCR = 0x50;
SPSR = 0x01;
DDRB |= 0x2E;
PORTB |= (1<<1);

//pwm
TCCR0B = B0000001;
TCCR1B = B0000001;

for (byte w=0; w++; w<64){
analogWrite(9,w); //Blue
analogWrite(6,w); //green
analogWrite(5,w);
// delay(2);
}
sei();
if (digitalRead(7)==0){
noise_mode=1;}
else{
noise_mode=0;}

}

Here's the error message I get:

BLEEP_DRUM_003:6: error: 'DAC_MCP49xx' does not name a type
BLEEP_DRUM_003:108: error: 'Bounce' does not name a type
BLEEP_DRUM_003:111: error: 'Bounce' does not name a type
BLEEP_DRUM_003:112: error: 'Bounce' does not name a type
BLEEP_DRUM_003:113: error: 'Bounce' does not name a type
BLEEP_DRUM_003:114: error: 'Bounce' does not name a type
BLEEP_DRUM_003.ino: In function 'void setup()':
BLEEP_DRUM_003:122: error: 'dac' was not declared in this scope
DDS.ino: In function 'void __vector_7()':
DDS:49: error: 'dac' was not declared in this scope
LOOP.ino: In function 'void loop()':
LOOP:7: error: 'bouncertap' was not declared in this scope
LOOP:8: error: 'bouncer1' was not declared in this scope
LOOP:9: error: 'bouncer2' was not declared in this scope
LOOP:10: error: 'bouncer4' was not declared in this scope
LOOP:11: error: 'bouncer3' was not declared in this scope
buttons.ino: In function 'void BUTTONS()':
buttons:14: error: 'bouncer1' was not declared in this scope
buttons:21: error: 'bouncer4' was not declared in this scope
buttons:27: error: 'bouncer2' was not declared in this scope
buttons:33: error: 'bouncer3' was not declared in this scope
buttons:42: error: 'bouncertap' was not declared in this scope
buttons:58: error: 'bouncer1' was not declared in this scope
buttons:65: error: 'bouncer4' was not declared in this scope
buttons:72: error: 'bouncer2' was not declared in this scope
buttons:79: error: 'bouncer3' was not declared in this scope
record.ino: In function 'void RECORD()':
record:41: error: 'bouncer1' was not declared in this scope
record:44: error: 'bouncer2' was not declared in this scope
record:47: error: 'bouncer4' was not declared in this scope
record:50: error: 'bouncer3' was not declared in this scope

This is for Alison who contacted me via PM:

I suggest you do not have these libraries in your libraries folder.
Under File:Preferences, there is a path - that path should have a libraries folder.
Put the libraries in there when you find them:

The sketch calls them out:
#include <Bounce.h>
#include <DAC_MCP49xx.h>

The errors indicate they are not being found:
BLEEP_DRUM_003:6: error: 'DAC_MCP49xx' does not name a type
BLEEP_DRUM_003:108: error: 'Bounce' does not name a type

Hi! Did this end up solving the problem? I'm trying to do the same thing and am running into the same problems!