LM2917 Dip8 (Frequency to voltage converter)

Used Products:

1. 10 KΩ
2. 100pf
3. 500pf
4. Arduino UNO
5. LM2917
6. Zener Diode 4v7

Code:

int sensorPin = A0; int ledPin = 3; int sensorValue = 0; int maxv = 0; void setup() { pinMode(ledPin, OUTPUT); Serial.begin(9600); } void loop() { sensorValue = analogRead(sensorPin); if (sensorValue > maxv) { maxv = sensorValue; } int mapv = map(sensorValue, 3, maxv, 0, 255); Serial.print("maxv: "); Serial.print(maxv); Serial.print(", map: "); Serial.print(mapv); Serial.print(", sensorValue: "); Serial.print(sensorValue); Serial.println(); analogWrite(ledPin , mapv>0?mapv:0); }