add color handling for LED
This commit is contained in:
		@@ -13,7 +13,7 @@ namespace basic {
 | 
			
		||||
    //% weight=50
 | 
			
		||||
    void setLedColor(int color) {
 | 
			
		||||
      if (!color) {
 | 
			
		||||
        uBit.rgb.Off();
 | 
			
		||||
        uBit.rgb.off();
 | 
			
		||||
        return;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
@@ -22,9 +22,7 @@ namespace basic {
 | 
			
		||||
      int g = (color >> 8) & 0xFF;
 | 
			
		||||
      int b = (color) & 0xFF;
 | 
			
		||||
      
 | 
			
		||||
      uBit.rgb.Set_Color(r,g,b,w);
 | 
			
		||||
      uBit.rgb.On();
 | 
			
		||||
      uBit.rgb.Send_to_LED();
 | 
			
		||||
      uBit.rgb.setColour(r,g,b,w);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										6
									
								
								libs/core/dal.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								libs/core/dal.d.ts
									
									
									
									
										vendored
									
									
								
							@@ -190,12 +190,6 @@ declare const enum DAL {
 | 
			
		||||
    MICROBIT_SERIAL_EVT_TX_EMPTY = 2,
 | 
			
		||||
    MICROBIT_UART_S_EVT_TX_EMPTY = 3,
 | 
			
		||||
    // built/yt/yotta_modules/microbit-dal/inc//drivers/CalliopeRGB.h
 | 
			
		||||
    RGB_LED_DEFAULT_GREEN = 0,
 | 
			
		||||
    RGB_LED_DEFAULT_RED = 0,
 | 
			
		||||
    RGB_LED_DEFAULT_BLUE = 0,
 | 
			
		||||
    RGB_LED_DEFAULT_WHITE = 0,
 | 
			
		||||
    RGB_KEEP_VALUE = -1,
 | 
			
		||||
    RGB_LED_MAX_INTENSITY = 50,
 | 
			
		||||
    // built/yt/yotta_modules/microbit-dal/inc//drivers/CalliopeSoundMotor.h
 | 
			
		||||
    CALLIOPE_SM_DEFAULT_DUTY_M = 50,
 | 
			
		||||
    CALLIOPE_SM_DEFAULT_DUTY_S = 100,
 | 
			
		||||
 
 | 
			
		||||
@@ -43,8 +43,7 @@
 | 
			
		||||
            "microbit-dal": {
 | 
			
		||||
                "bluetooth": {
 | 
			
		||||
                    "enabled": 0
 | 
			
		||||
                },
 | 
			
		||||
                "debug": 1
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,12 @@
 | 
			
		||||
basic.setLedColor(Colors.Blue)
 | 
			
		||||
basic.pause(500)
 | 
			
		||||
basic.setLedColor(Colors.Red)
 | 
			
		||||
basic.pause(500)
 | 
			
		||||
basic.setLedColor(Colors.Green)
 | 
			
		||||
basic.pause(500)
 | 
			
		||||
basic.setLedColor(0);
 | 
			
		||||
basic.setLedColor(Colors.Violet)
 | 
			
		||||
basic.pause(100)
 | 
			
		||||
led.plot(0, 0)
 | 
			
		||||
basic.pause(1000);
 | 
			
		||||
basic.forever(() => {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user