Hek
Posts: 1
Joined: Mon Oct 10, 2016 7:45 pm

LED Strip Dimming

Mon Oct 10, 2016 7:55 pm

Hello,

I have a White LED Strip and i wanna dim it with RPi.
So this is my circuit(the wires are on other pins, and i have multimeter connected right now) Image.

Parts:
Power Supply
RPi B2
Dual H Bridge DC Stepper Motor Drive Controller Board Module Arduino L298N HG
LED Strip

Theory is that i should with pwm control output, but only output which i'm getting is like +/-0.0001V

my code is

Code: Select all

import wiringpi
import time
wiringpi.wiringPiSetupGpio()
wiringpi.pinMode(18, 2)
wiringpi.pwmWrite(18, 0)
value = 0
increment = 4
increasing = True
count = 0

while count < 100000:
       wiringpi.pwmWrite(18, value)

       if increasing:
               value += increment
               time.sleep(0.002)
       else:
               value -= increment
               time.sleep(0.002)

       if (value >=1024):
               increasing = False

       if (value <= 0):
               increasing = True

       time.sleep(0.002)
       count = count + 1


texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: LED Strip Dimming

Wed Oct 12, 2016 2:11 pm

You diagram shows Ground connected to pin 4 of the pi, not pin 6 ?
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

Return to “Python”