Wednesday, 8 September 2010

How to do something after a certain number of shakes

More android stuff below - this post is mostly to save me the effort of having to upload pics somewhere else on the web.  Proceed at your own peril :-)
 Someone on the app inventor group wanted to make their app do something after a certain number of shakes, and wasn't sure how to make that happen.  Below is my attempt (which just makes the phone vibrate after 5 shakes - each shake must be at least 2 seconds apart).

All you need on the design screen is a label (which I've imaginatively titled Label1), a clock (Clock1), a sound (no file needed, called Sound1) and an Accelerometer Sensor (you guessed it: AccellerometerSensor1).

Further question on how to sort lists: one answer is below

and another question on how to count how many times something occurs in a list:

(for those of you wondering, I'm using blogger to host these images so I can post links to the app inventor group - I'm just gonna keep editing this post if I need to add more)

No comments: