App Name

RecallCMS

Greeting Prefix

Auto

Learner Name

Aspirant

Home Subtitle

Spaced Repetition (SM-2) Master PYQ Decks

AdSense Publisher ID

ca-pub-0000000000000000

AdSense Auto Ads (ON or OFF)

OFF

Rest Stop Ad Slot ID

1234567890

Home and Game Page Ad Slot ID

0987654321

Default Batch Size

20

Sunday, October 17, 2021

Create Compass app in Sketchware

 To create a Compass app in Sketchware, follow the steps given below.

1. In View area add an ImageView imageview1. Set image of a Compass as it's image. Make sure that North is towards the top.


2. Create a Gyroscope component gyro and another Gyroscope component gyroMagnet.


3. Create a More block extra and put following code in it.

}

private float[] floatGravity = new float[3];

private float[] floatGeoMagnetic = new float[3];

private float[] floatOrientation = new float[3];

private float[] floatRotationMatrix = new float[9];

{


4. In onCreate event use blocks

Gyroscope gyro sensor stop,

and Gyroscope gyroMagnet sensor stop.

After that put following code in an add source directly block:

gyro.registerListener(_gyro_sensor_listener, gyro.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),SensorManager.SENSOR_DELAY_NORMAL);

gyro.registerListener(_gyroMagnet_sensor_listener, gyro.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD),SensorManager.SENSOR_DELAY_NORMAL);



5. In onPause event use blocks

Gyroscope gyro sensor stop,

and Gyroscope gyroMagnet sensor stop.


6. In onResume event put following code in an add source directly block:

gyro.registerListener(_gyro_sensor_listener, gyro.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),SensorManager.SENSOR_DELAY_NORMAL);

gyro.registerListener(_gyroMagnet_sensor_listener, gyro.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD),SensorManager.SENSOR_DELAY_NORMAL);


7. In gyro: onSensorChanged event use an add source directly block and put following code:

floatGravity = _param1.values;

SensorManager.getRotationMatrix(floatRotationMatrix, null, floatGravity, floatGeoMagnetic);

SensorManager.getOrientation(floatRotationMatrix, floatOrientation);

imageview1.setRotation((float) (-floatOrientation[0]*180/3.14159265359));



8. In gyroMagnet: onSensorChanged event use an add source directly block and put following code:

floatGeoMagnetic = _param1.values;

SensorManager.getRotationMatrix(floatRotationMatrix, null, floatGravity, floatGeoMagnetic);

SensorManager.getOrientation(floatRotationMatrix, floatOrientation);

imageview1.setRotation((float) (-floatOrientation[0]*180/3.14159265359));



9. Save and run the project. You will see the top of image rotate to the North direction.



No comments:

Home
⚡ 0d
Good Morning
Aspirant

Spaced Repetition (SM-2) Master PYQ Decks

Loading Master PYQ Decks...

Free Active Recall & Spaced Repetition for Competitive Exams

Practice verified Previous Year Questions (PYQs) and speed calculation drills for SSC CGL, CHSL, MTS, UPSSSC PET, RRB NTPC, Group D, CTET, and State PSC exams. Our SuperMemo-2 (SM-2) engine schedules each flashcard right before you forget it and saves progress offline on your device.

30s
MASTER DECK
Question reference graphic
Answer & Explanation
Tap anywhere to reveal answer
Practice Games

Select a practice game page to start playing

Batch Complete!

Great work finishing this batch.

0
Reviewed
0
Memorized
0
Remaining
Stats & Backup

Memory Telemetry

0
Tracked Cards
0
Due Today
2.50
Avg Ease
0
Starred PYQs

Offline Progress Backup

Export or restore your IndexedDB spaced-repetition intervals as a portable JSON file.

Page

Loading Page...