6 years, 8 months ago.

Problem writing data from ADC to a file


I am trying to get audio data using microphone and write it to a local system file in mbed. i have to use this data for occupancy analysis. I am getting some values through the ADC but when i write data to a local file system in mbed the mbed connect/disconnects from the system and i can not actually see what is written inside the file.

Why is this so ?? the problem resolves if i put a delay in writing the file.

Also anyone can help me how to process the audio data from the microphone to make it meaningful i have to use it to decide if someone is present in the room or not ?? how can i do it ?

1 Answer

6 years, 8 months ago.

See the documentation of local file system: When you use it locally it disconnects from your PC to prevent both writing at the same time, corrupting the entire thing. Your PC also only reads data from a USB disk once, if the mbed then changes the data and the disk is not disconnected + reconnected your PC will never notice there is new data.

To check if someone is in a room you could start by simply calculating the amplitude of the received sound.

Accepted Answer

Thanks Eric for your answer but what should i do if i have to write data to a file at a fast speed. The data may have been written on the local file system but what happens as i connects the mbed with my laptop as the code is also running inside it so the data starts to be written instantly

posted by Syed Aftab 04 Nov 2013

I don't understand what you mean, as soon as you open a file in the local file system the mbed will always be disconnected.

posted by Erik - 04 Nov 2013