gpio pwm init

This commit is contained in:
2021-03-03 21:42:00 +01:00
parent 49f47d5410
commit 1e3939e720
2 changed files with 29 additions and 22 deletions

View File

@ -1,27 +1,29 @@
import RPi.GPIO as GPIO
freq = 800
pins_out = {
'kamera' : 2,
'encoder' : 3
'kamera' : {'nr' : 2, 'name' : 'Relais, Kamera', 'state' : GPIO.HIGH},
'encoder' : {'nr' : 3, 'name' : 'Relais, Encoder', 'state' : GPIO.HIGH}
}
pins_in = {
'endschalter1' : {'nr' : 23, 'name' : 'Endschalter, Motor 1', 'state' : GPIO.HIGH},
'endschalter2' : {'nr' : 26, 'name' : 'Endschalter, Motor 2', 'state' : GPIO.HIGH},
'endschalter3' : {'nr' : 25, 'name' : 'Endschalter, Motor 2', 'state' : GPIO.HIGH}
'endschalter3' : {'nr' : 25, 'name' : 'Endschalter, Motor 3', 'state' : GPIO.HIGH}
}
pins_pwm = {
'm1_a1' : 17,
'm1_b1' : 18,
'm1_a2' : 27,
'm1_b2' : 22,
'm2_a1' : 19,
'm2_b1' : 13,
'm2_a2' : 6,
'm2_b2' : 5,
'm3_a1' : 16,
'm3_b1' : 12,
'm3_a2' : 21,
'm3_b2' : 20,
'm1_a1' : {'nr' : 17, 'typ' : GPIO.setup(17, GPIO.OUT), 'pwm' : GPIO.PWM(17, freq)},
'm1_b1' : {'nr' : 18, 'typ' : GPIO.setup(18, GPIO.OUT), 'pwm' : GPIO.PWM(18, freq)},
'm1_a2' : {'nr' : 27, 'typ' : GPIO.setup(27, GPIO.OUT), 'pwm' : GPIO.PWM(27, freq)},
'm1_b2' : {'nr' : 22, 'typ' : GPIO.setup(22, GPIO.OUT), 'pwm' : GPIO.PWM(22, freq)},
'm2_a1' : {'nr' : 19, 'typ' : GPIO.setup(19, GPIO.OUT), 'pwm' : GPIO.PWM(19, freq)},
'm2_b1' : {'nr' : 13, 'typ' : GPIO.setup(13, GPIO.OUT), 'pwm' : GPIO.PWM(13, freq)},
'm2_a2' : {'nr' : 6, 'typ' : GPIO.setup(6, GPIO.OUT), 'pwm' : GPIO.PWM(6, freq)},
'm2_b2' : {'nr' : 5, 'typ' : GPIO.setup(5, GPIO.OUT), 'pwm' : GPIO.PWM(5, freq)},
'm3_a1' : {'nr' : 16, 'typ' : GPIO.setup(16, GPIO.OUT), 'pwm' : GPIO.PWM(16, freq)},
'm3_b1' : {'nr' : 12, 'typ' : GPIO.setup(12, GPIO.OUT), 'pwm' : GPIO.PWM(12, freq)},
'm3_a2' : {'nr' : 21, 'typ' : GPIO.setup(21, GPIO.OUT), 'pwm' : GPIO.PWM(21, freq)},
'm3_b2' : {'nr' : 20, 'typ' : GPIO.setup(20, GPIO.OUT), 'pwm' : GPIO.PWM(20, freq)}
}