hey everyone,
i'm working on interactive installation , need coding part.
i bought vs1053 shield, connected arduino uno written in this tutorial.
i used player_simple code library , add ldr part. idea take value ldr , check if smaller 150. if > play track 1, , if not > pause track 1. problem when sensor got smaller value , audio starts, sensor stop reading next values.... , audio played until track on , after continues read next values.
i want find way while audio plays, sensor still reads values , in moment got higher value pause audio.
this got far... maybe if statement not 1 need use (i'm not sure). tried while , do..while still nothing:
can suggest something?
i'm working on interactive installation , need coding part.
i bought vs1053 shield, connected arduino uno written in this tutorial.
i used player_simple code library , add ldr part. idea take value ldr , check if smaller 150. if > play track 1, , if not > pause track 1. problem when sensor got smaller value , audio starts, sensor stop reading next values.... , audio played until track on , after continues read next values.
i want find way while audio plays, sensor still reads values , in moment got higher value pause audio.
this got far... maybe if statement not 1 need use (i'm not sure). tried while , do..while still nothing:
code: [select]
void loop() {
//check ldr value
val1 = analogread(ldr1);
serial.print("sensor1 = " );
serial.println(val1);
delay(1000);
//if
if (val1 < 150){
serial.println(f("playing track 001"));
musicplayer.playfullfile("track0~1.mp3");
//play file in background, requires interrupts!
//serial.println(f("playing track 002"));
//musicplayer.startplayingfile("track0~2.mp3");
}else{
musicplayer.pauseplaying(true);
}
delay(100);
}
can suggest something?
Arduino Forum > Using Arduino > Audio > Control audio from micro SD with LDR
arduino
Comments
Post a Comment