@@ -1658,9 +1658,10 @@ def is_pressed(self):
16581658 A boolean indicating whether the current touch sensor is being
16591659 pressed.
16601660 """
1661+
16611662 self .mode = self .MODE_TOUCH
1662- return self .value (0 )
16631663
1664+ return self .value (0 )
16641665
16651666class ColorSensor (Sensor ):
16661667
@@ -1695,14 +1696,18 @@ def reflected_light_intensity(self):
16951696 """
16961697 Reflected light intensity as a percentage. Light on sensor is red.
16971698 """
1699+
16981700 self .mode = self .MODE_COL_REFLECT
1701+
16991702 return self .value (0 )
17001703
17011704 def ambient_light_intensity (self ):
17021705 """
17031706 Ambient light intensity. Light on sensor is dimly lit blue.
17041707 """
1708+
17051709 self .mode = self .MODE_COL_AMBIENT
1710+
17061711 return self .value (0 )
17071712
17081713 def color (self ):
@@ -1717,30 +1722,37 @@ def color(self):
17171722 - 6: White
17181723 - 7: Brown
17191724 """
1725+
17201726 self .mode = self .MODE_COL_COLOR
1727+
17211728 return self .value (0 )
17221729
17231730 def red (self ):
17241731 """
17251732 Red component of the detected color, in the range 0-1020.
17261733 """
1734+
17271735 self .mode = self .MODE_RGB_RAW
1736+
17281737 return self .value (0 )
17291738
17301739 def green (self ):
17311740 """
17321741 Green component of the detected color, in the range 0-1020.
17331742 """
1743+
17341744 self .mode = self .MODE_RGB_RAW
1745+
17351746 return self .value (1 )
17361747
17371748 def blue (self ):
17381749 """
17391750 Blue component of the detected color, in the range 0-1020.
17401751 """
1752+
17411753 self .mode = self .MODE_RGB_RAW
1742- return self .value (2 )
17431754
1755+ return self .value (2 )
17441756
17451757class UltrasonicSensor (Sensor ):
17461758
@@ -1776,25 +1788,30 @@ def distance_centimeters(self):
17761788 Measurement of the distance detected by the sensor,
17771789 in centimeters.
17781790 """
1791+
17791792 self .mode = self .MODE_US_DIST_CM
1793+
17801794 return self .value (0 )
17811795
17821796 def distance_inches (self ):
17831797 """
17841798 Measurement of the distance detected by the sensor,
17851799 in inches.
17861800 """
1801+
17871802 self .mode = self .MODE_US_DIST_IN
1803+
17881804 return self .value (0 )
17891805
17901806 def other_sensor_present (self ):
17911807 """
17921808 Value indicating whether another ultrasonic sensor could
17931809 be heard nearby.
17941810 """
1811+
17951812 self .mode = self .MODE_US_LISTEN
1796- return self .value (0 )
17971813
1814+ return self .value (0 )
17981815
17991816class GyroSensor (Sensor ):
18001817
@@ -1830,16 +1847,28 @@ def angle(self):
18301847 The number of degrees that the sensor has been rotated
18311848 since it was put into this mode.
18321849 """
1850+
18331851 self .mode = self .MODE_GYRO_ANG
1852+
18341853 return self .value (0 )
18351854
18361855 def rate (self ):
18371856 """
18381857 The rate at which the sensor is rotating, in degrees/second.
18391858 """
1859+
18401860 self .mode = self .MODE_GYRO_RATE
1861+
18411862 return self .value (0 )
18421863
1864+ def rate_and_angle (self ):
1865+ """
1866+ Angle (degrees) and Rotational Speed (degrees/second).
1867+ """
1868+
1869+ self .mode = self .MODE_GYRO_G_A
1870+
1871+ return self .value (0 ), self .value (1 )
18431872
18441873class InfraredSensor (Sensor ):
18451874
@@ -1875,9 +1904,10 @@ def proximity(self):
18751904 A measurement of the distance between the sensor and the remote,
18761905 as a percentage. 100% is approximately 70cm/27in.
18771906 """
1907+
18781908 self .mode = self .MODE_IR_PROX
1879- return self .value (0 )
18801909
1910+ return self .value (0 )
18811911
18821912class SoundSensor (Sensor ):
18831913
@@ -1904,17 +1934,20 @@ def sound_pressure(self):
19041934 A measurement of the measured sound pressure level, as a
19051935 percent. Uses a flat weighting.
19061936 """
1937+
19071938 self .mode = self .MODE_DB
1939+
19081940 return self .value (0 )
19091941
19101942 def sound_pressure_low (self ):
19111943 """
19121944 A measurement of the measured sound pressure level, as a
19131945 percent. Uses A-weighting, which focuses on levels up to 55 dB.
19141946 """
1947+
19151948 self .mode = self .MODE_DBA
1916- return self .value (0 )
19171949
1950+ return self .value (0 )
19181951
19191952class LightSensor (Sensor ):
19201953
@@ -1940,16 +1973,19 @@ def reflected_light_intensity(self):
19401973 """
19411974 A measurement of the reflected light intensity, as a percentage.
19421975 """
1976+
19431977 self .mode = self .MODE_REFLECT
1978+
19441979 return self .value (0 )
19451980
19461981 def ambient_light_intensity (self ):
19471982 """
19481983 A measurement of the ambient light intensity, as a percentage.
19491984 """
1985+
19501986 self .mode = self .MODE_AMBIENT
1951- return self .value (0 )
19521987
1988+ return self .value (0 )
19531989
19541990
19551991# ~autogen
0 commit comments