📐
Thunkable Docs
Build an AppDrag and Drop DocsSnap to Place Docs
Snap to Place
Snap to Place
  • 👋Welcome to Thunkable Docs
  • 👶Getting Started
    • Signing In
    • Your Thunkable Projects Page
    • Tutorials
    • Live Test your App
  • 🆕Create New Project
    • Project Settings
    • Project Assets and Sizes
  • Thunkable Sample Projects
  • Public Gallery of Projects
  • 🛠️ Components
  • 🔘User Interface
  • Button
  • Label
  • Text Input
  • List Viewer
  • Web Viewer
  • Switch
  • Slider
  • Alert
  • Loading Icon
  • Date Input
  • Time Input
  • PDF Reader
  • Rating
  • 📊Data Viewers
  • Data Viewer List
  • Data Viewer Grid
  • Custom Data Viewer Layout
  • Data Sources
  • 📐Layout
  • Top Tab Navigator
  • Bottom Tab Navigator
  • Stack Navigator
  • Drawer Navigator
  • Screen
  • Row
  • Column
  • 📷 Image
  • Image
  • Photo Library
  • Camera
  • Barcode Scanner
  • Image Recognizer
  • Animation by Lottie
  • Video
  • Video Recorder
  • 🗄️ Data
  • Local Storage
  • Local DB
  • Realtime DB by Firebase
  • Airtable
  • Media DB by Cloudinary
  • File Picker
  • Web API
  • 🌍Location
  • Maps by Google and Apple
  • Location Sensor
  • 💲Monetization
  • Ads by AdMob
  • In-App Purchase
  • 🌐Sensors
  • Gyroscope
  • Magnetometer
  • Accelerometer
  • Timer
  • Bluetooth Low Energy
  • 🔊Voice
  • Sound
  • Text to Speech
  • Speech Recognizer
  • Translator
  • Audio Recorder
  • 🤝Social
  • Share
  • Email Sign In by Firebase
  • Push Notifications by One Signal
  • 🎮Gaming
  • Canvas
  • Sprites
  • Sprite Gallery
  • Canvas Label
  • 🤖Gaming Blocks🎮
  • Events
  • Motion
  • Looks
  • Direction
  • Sensing
  • Add & Remove
  • Stage
  • Canvas Label
  • 🤖Blocks
  • Control
  • Logic
  • Math
  • Text
  • Lists
  • Color
  • Objects
  • Device
  • Variables
  • Functions
  • "Any Component" Blocks
  • 🖥️ App Services & Emulators
  • 🔒App Data Privacy
  • ➕Make Copy
  • 📥Download
  • 📤Share
  • 📱Publish
  • Publish to App Store (iOS)
    • TestFlight Overview
      • TestFlight in Depth
  • Publish to Play Store (Android) with AAB
  • Publish as a Web App
  • Generate Screenshots
  • 🔎Troubleshooting
    • Login Issues
    • FAQs
  • 📏Intro to Spacing
  • 🖼️ Intro to Sizing
  • 🔤Fonts
  • 💾Managing Storage
  • 📝Bugs and Product Feedback
  • Snap to Place Hour of Code Videos
Powered by GitBook
On this page
  • Description
  • Blocks
  • Events
  • Functions
  • Properties

Was this helpful?

Export as PDF

Magnetometer

PreviousGyroscopeNextAccelerometer

Last updated 2 years ago

Was this helpful?

Description

The magnetometer is used to measure magnetic flux density. This is the total magnetic field passing through a given area, per metre squared, T⋅m2m2\frac{T \cdot m^2}{m^2}m2T⋅m2​ . The sensor will returns values with units of microtesla μT\mu TμT for each of the three coordinate axes; x, y and, z. The magnetic flux density is quite similar to magnetic field strength.

‌

Blocks

Events

When Magnetometer Changes

When the magnetometer detects a change in the ambient magnetic field the Changes event will fire. The event returns 4 parameters that we can work with.

Parameter

Type

Returns

xFluxDensity

Number

yFluxDensity

Number

zFluxDensity

Number

error

String

Error message from the Sensor

Functions

Call X

Returns flux density, in the x direction, expressed in μT\mu TμT

Call Y

Returns flux density, in the y direction, expressed in μT\mu TμT

Call Z

Returns flux density, in the x direction, expressed in μT\mu TμT

Call Heading

Returns a value between 0 and 360 which denotes the user's direction relative to the Earth's geographic North Pole

Properties

Enabled

The magnetometer is, by default, turned on, but the enabled property can be used to turn in on and off by setting it to true or false respectively.

Property

Type

Default

set Enabled

Bool

true

get Enabled

Bool

true

Flux density, in the x direction, expressed in

Flux density, in the y direction, expressed in

Flux density, in the z direction, expressed in

μT\mu TμT
μT\mu TμT
μT\mu TμT