First init.

This commit is contained in:
2025-10-12 09:13:56 +02:00
commit 1548aeaf9b
458 changed files with 118808 additions and 0 deletions

23
PWM_Test/PWM_Test.ino Normal file
View File

@@ -0,0 +1,23 @@
const int potPin = A0; // analog pin for potentiometer
const int pwmPin = 6; // PWM pin connected to the transistor gate
const int pwm2Pin = 5;
void setup() {
pinMode(pwmPin, OUTPUT); // set pwmPin as output
pinMode(pwm2Pin, OUTPUT);
}
void loop() {
// read the potentiometer value (0-1023)
int potValue = analogRead(potPin);
// map the potentiometer value to a PWM value (0-255)
int pwmValue = map(potValue, 0, 1023, 0, 255);
// write the PWM value to the PWM pin
analogWrite(pwmPin, pwmValue);
analogWrite(pwm2Pin, pwmValue);
// slight delay to stabilize readings
delay(10);
}