import time import board from rgb import RGB # import the RGB class from the rgb module r1 = board.D3 g1 = board.D4 b1 = board.D5 r2 = board.D8 g2 = board.D9 b2 = board.D10 myRGB1 = RGB(r1,g1,b1) # create a new RGB object, using pins 3, 4, and 5 myRGB2 = RGB(r2,g2,b2) # create a new RGB object, using pins 8, 9, and 10 myRGB1.red() # Glow red myRGB2.green() # Glow green time.sleep(1) myRGB1.blue() # Glow blue myRGB2.cyan() # Glow... you get it... time.sleep(1) myRGB1.magenta() # Did you know magenta isn't in the rainbow? myRGB2.yellow() # Like you learned in first grade, red and green make... huh? time.sleep(1) # extra spicy (optional) part myRGB1.rainbow("rate1") # Fade through the colors of the rainbow at the given rate. Oooooh, pretty! myRGB2.rainbow("rate2") # Fade through the colors of the rainbow at the given rate. Oooooh, pretty! time.sleep(1)
import time import board from rgb import RGB # import the RGB class from the rgb module r1 = board.D3 g1 = board.D4 b1 = board.D5 r2 = board.D8 g2 = board.D9 b2 = board.D10 myRGB1 = RGB(r1, g1, b1) # create a new RGB object, using pins 3, 4, and 5 myRGB2 = RGB(r2, g2, b2) # create a new RGB object, using pins 8, 9, and 10 myRGB1.red() # Glow red myRGB2.green() # Glow green time.sleep(1) myRGB1.blue() # Glow blue myRGB2.cyan() # Glow... you get it... time.sleep(1) myRGB1.magenta() # Did you know magenta isn't in the rainbow? myRGB2.yellow() # you learned in first grade, red and green make... huh? time.sleep(1) # extra spicy (optional) part myRGB1.rainbow() # Fade through the colors of the rainbow at the given rate. Oooooh, pretty! myRGB2.rainbow() # Fade through the colors of the rainbow at the given rate. Oooooh, pretty! time.sleep(1)
import time import board from rgb import RGB # import the RGB class from the rgb module r1 = board.D10 g1 = board.D11 b1 = board.D12 r2 = board.D3 g2 = board.D4 b2 = board.D5 myRGB1 = RGB(r1, g1, b1) # create a new RGB object, using pins 3, 4, and 5 myRGB2 = RGB(r2, g2, b2) # create a new RGB object, using pins 8, 9, and 10 myRGB1.red() # Glow red myRGB2.green() # Glow green time.sleep(1) myRGB1.blue() # Glow blue myRGB2.cyan() # Glow... you get it... time.sleep(1) myRGB1.magenta() # Did you know magenta isn't in the rainbow? myRGB2.yellow() # Like you learned in fi make... huh? time.sleep(1) myRGB1.rainbow("rate1") myRGB2.rainbow("rate2") time.sleep(1)
import time import board #pylint: disable-msg=import-error from rgb import RGB r = board.D2 g = board.D3 b = board.D4 myRGB = RGB(r, g, b) print("go") while True: myRGB.red() time.sleep(0.1) myRGB.green() time.sleep(0.1) myRGB.blue() time.sleep(0.1) myRGB.cyan() time.sleep(0.1) myRGB.magenta() time.sleep(0.1) myRGB.yellow() time.sleep(0.1) myRGB.white() time.sleep(0.1) myRGB.black() time.sleep(0.1) myRGB.rainbow()
import time import board from rgb import RGB # import the RGB class from the rgb module r1 = board.D3 g1 = board.D4 b1 = board.D5 r2 = board.D8 g2 = board.D9 b2 = board.D10 myRGB1 = RGB(r1, g1, b1) # create a new RGB object, using pins 3, 4, and 5 myRGB2 = RGB(r2, g2, b2) # create a new RGB object, using pins 8, 9, and 10 rate1 = 2.0 rate2 = 0.5 myRGB1.red() # Glow red myRGB2.green() # Glow green time.sleep(1) myRGB1.blue() # Glow blue myRGB2.cyan() # Glow... you get it... time.sleep(1) myRGB1.magenta() # Did you know magenta isn't in the rainbow? myRGB2.yellow() # Like you learned in first grade, red and green make... huh? time.sleep(1) myRGB1.rainbow(rate1) myRGB1.rainbow(rate2) # extra spicy (optional) part
#print(myRGB1.kind) #print(myRGB2.kind) myRGB1.change_name("rex") myRGB1.red() # first RGB LED glow red myRGB2.green() # second RGB LED glow green time.sleep(1) myRGB1.blue() # first RGB LED glow blue myRGB2.cyan() # second RGB LED glow cyan time.sleep(1) myRGB1.magenta() # first RGB LED glow magenta myRGB2.yellow() # second RGB LED glow yellow time.sleep(1) # extra spicy (optional) part myRGB1.rainbow( rate1 ) # first RGB LED Fade through the colors of the rainbow at the given rate. myRGB2.rainbow( rate2 ) # second RGB LEDFade through the colors of the rainbow at the given rate. time.sleep(1)