Go Down

Topic: Auduino Fix + Delay (Read 3 times) previous topic - next topic

DuaneB

Hi,
   The way the delay switch on/off is implemented is ugly - everyone has buttons, not everyone has a switch so I wrote the code as a very simple button/toggle switch.

To force delay, replace this section of code

Code: [Select]

// if the delay button is pressed, toggle delay
  if(0 == digitalRead(DELAY_BUTTON))
  {
    bDelay = !bDelay;
    // keeping it simple,
    delay(500);
  }


with

Code: [Select]

bDelay = true;


I will change the delay toggling code for something less ugly some day soon.

Duane B

rcarduino.blogspot.com

Giò LFZ

I'll got the same Error here

Code: [Select]
  pinMode(BUTTON_PIN,INPUT);



i've attached a screenshot of the log


DuaneB

It looks as if you are trying to combine two sketches.

Can you compile each of the sketches on their own first ?

Do they do what you expect on their own ?

If your answer is yes and yes, I can tell you how to add the delay to the LDR sketch.

Duane B

Giò LFZ

I've compiled both scketches, the one with LDR sensor is working, the other not. I've attached a button to digital pin 4, but i can't hear the delay....

now I want to retry your scketch with an arduino duemilanove, instead of an arduino mega...



DuaneB

#14
Jan 24, 2013, 05:11 pm Last Edit: Jan 24, 2013, 05:20 pm by DuaneB Reason: 1
What are you expecting delay to sound like ?

EDIT: The delay is added to the output, so if you can hear the output, and bDelay = true; the delay is there.

As the Auduino outputs at a constant volume the delay can be heard as a reverb effect.

In projects with an attack/decay or even just on/off notes, the delay is more obvious as a repeat or echo of the initial note -

The same delay code running on the five dollar keyboard -
http://www.youtube.com/watch?v=ZuKoG15oObk&feature=player_embedded
http://rcarduino.blogspot.com/2012/10/five-dollar-synthesiser.html

Duane B

Go Up