Arduino and C

I am looking for some help on some c code.

What I need to be able to do is get the data from four microphones and send the readings to a computer. I need this to be in c.

I know what to do with the arduino code, but I am not for sure what to do with the c code.

I have read the common articles on serial programming and I still can't seem to figure it out.

I know how to open the USB serial port. And I have successfully been able to send a signal to the arduino board. However I am having difficulties reading.

I need to read the values coming from each microphone and then store those respective values in an array for each microphone.

I have tried some code already, however, I don't have it with me right now. I will update this with what I have tried later.

But for now I am just looking for some tips and possibly some examples.

Operating system?

What sample rate do you want to do this at? Using serial to transfer the data from two audio streams isn't going to work very fast. Do the math, look at the maximum baud rate you can have, divide that by 10 to get the maximum number of bytes you can transfer per second, then divide by two because you have two microphones.

Remember for audio (or any digital sampled information) you have to sample faster then the Nyquist rate. That is you need at least two samples at the highest frequency. So take that transfer rate and divide it by two to get the highest audio frequency you can transfer. Then you need a low pass filter after the amplifier to make sure frequencies higher that this do not get sampled.

Then you find it is not good enough.

then divide by two because you have two microphones.

sp. "four" :frowning: