Devices & Components
Arduino Nano
3 mm LED: Yellow
10kOhm potentiometer
Piezo Buzzer
Hardware & Tools
Soldering kit
Software & Tools
Arduino IDE
Project description
Code
Code
cpp
...
1#include <Capacitor.h> 2 3Capacitor cap1(7,A2); 4 5void setup() { 6 Serial.begin(9600); 7 pinMode(5, OUTPUT); 8} 9 10void loop() { 11 Serial.println(cap1.Measure()); 12 int sensorValue = analogRead(A0) / 8; 13 delay(10); 14 if (cap1.Measure() < sensorValue) { 15 digitalWrite(5, HIGH); 16 tone(10,500); 17 delay(500); 18 } 19 else { 20 digitalWrite(5, LOW); 21 noTone(10); 22 } 23 24}
Downloadable files
Schematic
...
Schematic.jpg

Comments
Only logged in users can leave comments