I need a simple white noise generator with adjustable amplitude.
Tone can't work with analogWrite at the same time, so I use delayMicroseconds(xx), and by varying the ratios, I can control the amplitude. I saw many other complicated noise generator codes. is this too easy to be true? and any draw back doing thing like this?
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int love;
// the setup routine runs once when you press reset:
void setup() {
}
// the loop routine runs over and over again forever:
void loop() {
love=random(200, 5000);
tone(8, love);
delayMicroseconds(20);
noTone(8);
delayMicroseconds(10);
}