Skip to content

Commit

Permalink
Update opladen batterij
Browse files Browse the repository at this point in the history
  • Loading branch information
frederickthienpont authored Nov 28, 2024
1 parent d64ff3a commit 4b63354
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions opladen batterij
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,27 @@ void loop() {

// Bereken de batterijspanning
float measuredVoltage = (sensorValue / 1023.0) * reference
diff --git a/opladen batterij b/opladen batterij
new file mode 100644
index 0000000..328a7c5
--- /dev/null
+++ b/opladen batterij
@@ -0,0 +1,18 @@
+// Constante waarden
+const int batteryPin = A0; // Analoge pin waarop de batterij is aangesloten
+const float voltageDividerRatio = 11.0; // Verhouding spanningsdeler (10k en 1k)
+const float referenceVoltage = 5.0; // Referentiespanning van Arduino (meestal 5V)
+
+// Variabelen
+float batteryVoltage = 0;
+
+void setup() {
+ Serial.begin(9600); // Start seriële communicatie
+}
+
+void loop() {
+ // Lees de analoge waarde
+ int sensorValue = analogRead(batteryPin);
+
+ // Bereken de batterijspanning
+ float measuredVoltage = (sensorValue / 1023.0) * reference

0 comments on commit 4b63354

Please sign in to comment.