@@ -15,7 +15,9 @@ enum LightIntensityMode {
 | 
				
			|||||||
    //% block="reflected light"
 | 
					    //% block="reflected light"
 | 
				
			||||||
    Reflected = ColorSensorMode.ReflectedLightIntensity,
 | 
					    Reflected = ColorSensorMode.ReflectedLightIntensity,
 | 
				
			||||||
    //% block="ambient light"
 | 
					    //% block="ambient light"
 | 
				
			||||||
    Ambient = ColorSensorMode.AmbientLightIntensity
 | 
					    Ambient = ColorSensorMode.AmbientLightIntensity,
 | 
				
			||||||
 | 
					    //% block="reflected light (raw)"
 | 
				
			||||||
 | 
					    ReflectedRaw = ColorSensorMode.RefRaw
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const enum ColorSensorColor {
 | 
					const enum ColorSensorColor {
 | 
				
			||||||
@@ -186,15 +188,13 @@ namespace sensors {
 | 
				
			|||||||
         * @param sensor the color sensor to query the request
 | 
					         * @param sensor the color sensor to query the request
 | 
				
			||||||
         */
 | 
					         */
 | 
				
			||||||
        //% help=sensors/color-sensor/rgbraw
 | 
					        //% help=sensors/color-sensor/rgbraw
 | 
				
			||||||
        //% block="**color sensor** %this| rgbraw"
 | 
					 | 
				
			||||||
        //% blockId=colorGetRgbRawColor
 | 
					 | 
				
			||||||
        //% parts="colorsensor"
 | 
					        //% parts="colorsensor"
 | 
				
			||||||
        //% blockNamespace=sensors
 | 
					        //% blockNamespace=sensors
 | 
				
			||||||
        //% this.fieldEditor="ports"
 | 
					        //% this.fieldEditor="ports"
 | 
				
			||||||
        //% weight=98
 | 
					        //% weight=98
 | 
				
			||||||
        //% group="Color Sensor"
 | 
					        //% group="Color Sensor"
 | 
				
			||||||
        //% blockGap=8
 | 
					        //% blockGap=8
 | 
				
			||||||
        getRgbRaw() {
 | 
					        rgbRaw(): number[] {
 | 
				
			||||||
            this.setMode(ColorSensorMode.RgbRaw);
 | 
					            this.setMode(ColorSensorMode.RgbRaw);
 | 
				
			||||||
            return [this.getNumber(NumberFormat.UInt16LE, 0), this.getNumber(NumberFormat.UInt16LE, 2), this.getNumber(NumberFormat.UInt16LE, 4)];
 | 
					            return [this.getNumber(NumberFormat.UInt16LE, 0), this.getNumber(NumberFormat.UInt16LE, 2), this.getNumber(NumberFormat.UInt16LE, 4)];
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -249,7 +249,12 @@ namespace sensors {
 | 
				
			|||||||
        //% group="Color Sensor"
 | 
					        //% group="Color Sensor"
 | 
				
			||||||
        light(mode: LightIntensityMode) {
 | 
					        light(mode: LightIntensityMode) {
 | 
				
			||||||
            this.setMode(<ColorSensorMode><number>mode)
 | 
					            this.setMode(<ColorSensorMode><number>mode)
 | 
				
			||||||
            return this.getNumber(NumberFormat.UInt8LE, 0)
 | 
					            switch(mode) {
 | 
				
			||||||
 | 
					                case LightIntensityMode.ReflectedRaw:
 | 
				
			||||||
 | 
					                    return this.reflectedLightRaw();
 | 
				
			||||||
 | 
					                default:
 | 
				
			||||||
 | 
					                    return this.getNumber(NumberFormat.UInt8LE, 0)
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /**
 | 
					        /**
 | 
				
			||||||
@@ -271,7 +276,8 @@ namespace sensors {
 | 
				
			|||||||
        /**
 | 
					        /**
 | 
				
			||||||
         * Gets the raw reflection light value
 | 
					         * Gets the raw reflection light value
 | 
				
			||||||
         */
 | 
					         */
 | 
				
			||||||
        getRefRaw() {
 | 
					        //%
 | 
				
			||||||
 | 
					        reflectedLightRaw(): number {
 | 
				
			||||||
            this.setMode(ColorSensorMode.RefRaw);
 | 
					            this.setMode(ColorSensorMode.RefRaw);
 | 
				
			||||||
            return this.getNumber(NumberFormat.UInt16LE, 0);
 | 
					            return this.getNumber(NumberFormat.UInt16LE, 0);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,7 +2,7 @@
 | 
				
			|||||||
  "name": "pxt-ev3",
 | 
					  "name": "pxt-ev3",
 | 
				
			||||||
  "version": "1.1.2",
 | 
					  "version": "1.1.2",
 | 
				
			||||||
  "description": "LEGO MINDSTORMS EV3 for Microsoft MakeCode",
 | 
					  "description": "LEGO MINDSTORMS EV3 for Microsoft MakeCode",
 | 
				
			||||||
  "private": true,
 | 
					  "private": false,
 | 
				
			||||||
  "keywords": [
 | 
					  "keywords": [
 | 
				
			||||||
    "JavaScript",
 | 
					    "JavaScript",
 | 
				
			||||||
    "education",
 | 
					    "education",
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user