Reading "beats" in and playing them back


any can offer me great! have far. it's supposed read in presses on analog touch sensor threshold of 50, store time between presses in array, play sequence flashing led in pin 13.


code: [select]
int beatarray[10]; //array storing beats

const int analogpin = 0;   //pin sensor on it
const int ledpin = 13;   //led output
const int threshold = 50;  //threshold

int timer = 100;
int count = 0;


void setup() {
//initialize led pin output
pinmode(ledpin, output);
//serial communication
serial.begin(9600);

}

void loop() {
//read value of sensor
int analogvalue = analogread(analogpin);
//is button pressed?
if (analogvalue > threshold){
 //yes = function
}else{

//no = nothing
}
delay(50);
}

function{

if(count=10){
//playback
}else{
beatarray[count] = time since last
reset timer
count ++;
}
}


the problem i'm having first off i'm not sure how timer works, , can't seem find in reference library.

secondly, i'm not sure how write function plays back. how access array , use output led?

huge help!



Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Reading "beats" in and playing them back


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums