B4A Library Attitude Indicator

A wrap for this Github project. Attached the B4A sample project, B4A library files (jar and xml), and the wrapper source code. Copy the library files to your additional library folder.

Sample code:
#Region  Project Attributes
    #ApplicationLabel: b4aSensorRotation
    #VersionCode: 1
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: portrait
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Private ai1 As AttitudeIndicator
    Private Label1 As Label
    Private Label2 As Label
    Private Label3 As Label
    Private Label4 As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    ai1.EarthColor = Colors.ARGB(255, 0x86, 0x5b, 0x4b)
    ai1.PitchLadderColor = Colors.ARGB(255, 0xff, 0xff, 0xff)
    ai1.BottomPitchLadderColor = Colors.ARGB(255, 0xff, 0xff, 0x00)
    ai1.MinPlaneColor = Colors.ARGB(255, 0xe8, 0xd4, 0xbb)
    ai1.SkyColor = Colors.ARGB(255, 0x36, 0xb4, 0xdd)
End Sub

Sub Activity_Resume
End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub ai1_orientation_changed(pitch As Float, roll As Float)
'    Log("pitch = " & pitch)
'    Log("roll = " & roll)
    Label3.Text = NumberFormat(pitch, 0,2)
    Label4.text = NumberFormat(roll, 0, 2)
End Sub



  • B4ALibFiles.zip
    9.5 KB · Views: 125
  • b4aSensorRotation.zip
    9.8 KB · Views: 112
  • TheJavaCode.zip
    8.1 KB · Views: 105