This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
built_in:sensors [2015/01/07 09:55] octazid [Methods] |
built_in:sensors [2018/01/03 10:23] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== |
- | ===== Create | + | |
- | Create Sensor objects using the CreateSensor function of the app object: | + | // |
+ | |||
+ | ===== Description | ||
+ | Create Sensor objects using the **CreateSensor** function of the **[[built_in: | ||
< | < | ||
- | Types available are: "Accelerometer", | + | Types available are: |
+ | * **Accelerometer** | ||
+ | * **MagneticField** | ||
+ | * **Orientation** | ||
+ | * **Light** | ||
+ | * **Proximity** | ||
+ | * **Temperature** | ||
+ | * **GameRotation** | ||
+ | * **GeomagneticRotation** | ||
+ | * **Gravity** | ||
+ | * **Gyroscope** | ||
+ | * **HeartRate** | ||
+ | * **Acceleration** | ||
+ | * **Pressure** | ||
+ | * **Humidity** | ||
+ | * **Rotation** | ||
+ | * **Motion** | ||
+ | * **StepCounter** | ||
+ | * **StepDetector** | ||
+ | |||
+ | Try **sns.GetNames()** which lists all the sensor information. You can probably scan for certain keywords. | ||
+ | |||
+ | You can also use a sensor id number instead of the name (just in case a future sensor is added). | ||
+ | |||
+ | You can use the **SetOnChange** function of the Sensor to set the name of a function you want to be called when a the changes occur. | ||
+ | |||
+ | Change the rate that a sensor checks for changes by adding one the options **"Fastest" | ||
+ | "Slow" | ||
- | You can use the SetOnChange function of the Sensor to set the name of a function you want to be called when a the changes occur. | ||
- | Change the rate that a sensor checks for changes by adding one the options " | ||
===== Methods ===== | ===== Methods ===== | ||
Some controls use the same methods.\\ | Some controls use the same methods.\\ | ||
For examples of the **[[same methods]]** look here. | For examples of the **[[same methods]]** look here. | ||
- | ^Method ^Description ^ | + | ^ Method |
- | |Sensor.Destroy() | | | + | | Sensor.GetAzimuth() |
- | |Sensor.GetAbsHeight() | | | + | | Sensor.GetHeight() |
- | |Sensor.GetAbsWidth() | | | + | | Sensor.GetNames() |
- | |Sensor.GetAzimuth() | | | + | | Sensor.GetPitch() |
- | |Sensor.GetHeight() | | | + | | Sensor.GetRoll() |
- | |Sensor.GetPitch() | | | + | | Sensor.GetType() |
- | |Sensor.GetPosition() | | | + | | Sensor.GetValues() | | |
- | |Sensor.GetRoll() | | | + | | Sensor.SetMaxRate( rate ) |
- | |Sensor.GetType() | | | + | | Sensor.SetMinChange( |
- | |Sensor.GetVisibility() | | | + | | Sensor.SetOnChange( |
- | |Sensor.GetWidth() | | | + | | Sensor.Start() |
- | |Sensor.Release() | | | + | | Sensor.Stop() |
- | |Sensor.SetBackColor( p1 ) | | | + | |
- | |Sensor.SetBackGradient( p1, | + | |
- | |Sensor.SetBackGradientRadial( p1, | + | |
- | |Sensor.SetBackground( p1,p2 ) | | | + | |
- | |Sensor.SetMargins( left, | + | |
- | |Sensor.SetMinChange( | + | |
- | |Sensor.SetOnChange( | + | |
- | |Sensor.SetPadding( p1,p2,p3,p4 ) | | | + | |
- | |Sensor.SetPosition( p1,p2,p3,p4 ) | | | + | |
- | |Sensor.SetScale( x,y ) | | | + | |
- | |Sensor.SetSize( p1,p2 ) | | | + | |
- | |Sensor.SetVisibility( p1 ) | | | + | |
- | |Sensor.Start() | | | + | |
- | |Sensor.Stop() | | | + | |
===== Examples ===== | ===== Examples ===== | ||
^Sensor Type ^Code Example ^ | ^Sensor Type ^Code Example ^ | ||
- | |Accelerometer | < | + | |Accelerometer | < |
{ | { | ||
lay = app.CreateLayout( " | lay = app.CreateLayout( " | ||
Line 58: | Line 72: | ||
{ | { | ||
txt.SetText( " | txt.SetText( " | ||
+ | } | ||
</ | </ | ||
- | |Orientation | < | + | |Orientation | < |
{ | { | ||
lay = app.CreateLayout( " | lay = app.CreateLayout( " | ||
Line 81: | Line 96: | ||
} | } | ||
</ | </ | ||
- | |Light | < | + | |Light | < |
{ | { | ||
lay = app.CreateLayout( " | lay = app.CreateLayout( " |