Cookie Shaker on mbed

14
Cookie Shaker gecko655 This slide was made for Advanced OS

Transcript of Cookie Shaker on mbed

Cookie Shakergecko655

This slide was made for Advanced OS

Do you know...

Cookie clicker

• Launched on 2013/8/8

• Creator: Ortail

• Was in the topic in Japan around 2013/9

In the mbed

• mbed has a button, so I could use it for click but…

• mbed also has an accelerator, so let’s increase COOKIES by SHAKING mbed.

Detect shaking• The value of accelerator includes the effect of gravity, which is useless for detect shaking.

• I used jerk(躍度) (derivative of acceleration).

• I used schmitt trigger in the program.

• trigger is on if jerk > 175 [gravity/s] for 0.01ms

• trigger is off if jerk < 0.01 [gravity/s] for 0.01ms

• Shaking occurred when rising the trigger.

Gramma (BBA)• I think, Gramma (a.k.a BBA, ババア in Japan) is not so cute and I should change the character.

• Cookie, cookie, cookie..

Gramma (BBA)• I think, Gramma (a.k.a BBA, ババア in Japan) is not so cute and I should change the character.

• Cookie, cookie, cookie..

• Tippy!!

Dotted picture

• Tippy works to bake cookies in the LCD.

• Will show you in the demo.

Threads• Detecting accelerator shaking and increase cookies

• Increasing cookies at interval (baked by Tippies!)

• Buying Tippies by clicking button.

• Printing LCD

Communication between threads

• # of cookies has to be increased and decreased by 3 threads.

• Mutex is used.

Shaking

Buy tippy

Bake cookie in interval

Cookie

Increase 1

Decrease 10

Increase # of tippies in every 10 seconds

Thread priorities• User interactions (shaking detection and buying tippy) should have the highest priority.

• In mbed-RTOS, Ticker has the highest priority and I couldn’t change it.

• I wanted to use Ticker for drawing LCD every 0.1 seconds, but I used lower priority Thread to avoid this.

DEMO

Any questions?