diff --git a/modules/hu_source.py b/modules/hu_source.py index 226120ea..eaeb0801 100644 --- a/modules/hu_source.py +++ b/modules/hu_source.py @@ -595,7 +595,7 @@ def select( self, index, subIndex=None ): self.__printer('Setting active source to {0}: {1:s}'.format(index,self.lSource[index]['displayname'])) self.iCurrentSource[0] = index self.iCurrentSource[1] = subIndex - self.source_manager.getPluginByName(self.lSource[index]['name']).plugin_object.on_activate(subIndex) + self.source_manager.getPluginByName(self.lSource[index]['name']).plugin_object.on_activate(subIndex) # TODO! do we want to activate by calling ON-activate???? return True ''' @@ -695,7 +695,7 @@ def source_iterator(ix_start, ix_stop, j_start, reverse): if subsource['available']: self.iCurrentSource[0] = i self.iCurrentSource[1] = j - self.source_manager.getPluginByName(self.lSource[i]['name']).plugin_object.on_activate(j) + self.source_manager.getPluginByName(self.lSource[i]['name']).plugin_object.on_activate(j) # TODO! do we want to activate by calling ON-activate???? return self.iCurrentSource j += 1 i += 1 diff --git a/rgb_test_werkt.py b/rgb_test_werkt.py new file mode 100644 index 00000000..0c8c0048 --- /dev/null +++ b/rgb_test_werkt.py @@ -0,0 +1,67 @@ +#defining the RPi's pins as Input / Output +import RPi.GPIO as GPIO + +#importing the library for delaying command. +import time + +#used for GPIO numbering +GPIO.setmode(GPIO.BCM) + +#closing the warnings when you are compiling the code +GPIO.setwarnings(False) + +RUNNING = True + +#defining the pins +red = 16 +green = 12 +blue = 23 + +#defining the pins as output +GPIO.setup(red, GPIO.OUT) +GPIO.setup(green, GPIO.OUT) +GPIO.setup(blue, GPIO.OUT) + +#choosing a frequency for pwm +Freq = 100 + +#defining the pins that are going to be used with PWM +RED = GPIO.PWM(red, Freq) +GREEN = GPIO.PWM(green, Freq) +BLUE = GPIO.PWM(blue, Freq) + +try: + #we are starting with the loop + while RUNNING: + #lighting up the pins. 100 means giving 100% to the pin + RED.start(100) + GREEN.start(1) + BLUE.start(1) + #For anode RGB LED users, if you want to start with RED too the only thing to be done is defining RED as one and GREEN and BLUE as 100. + + for x in range(1,101): + # for changing the width of PWM, this command is used + GREEN.ChangeDutyCycle(x) + #for anode LED users, just change x with 101-x + + # and for delay time.sleep is used. You can chance the duration of the colors with changing the time from here + time.sleep(0.05) + + for x in range(1,101): + + RED.ChangeDutyCycle(101-x) + time.sleep(0.025) + + for x in range(1,101): + GREEN.ChangeDutyCycle(101-x) + BLUE.ChangeDutyCycle(x) + time.sleep(0.025) + + for x in range(1,101): + RED.ChangeDutyCycle(x) + time.sleep(0.025) + +except KeyboardInterrupt: + # the purpose of this part is, when you interrupt the code, it will stop the while loop and turn off the pins, which means your LED won't light anymore + RUNNING = False + GPIO.cleanup() \ No newline at end of file