cookie shaker on mbed
TRANSCRIPT
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!!
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.