Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a project "face-touch-warning-system-using-microbit" in docs #4860

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions docs/projects/face-touch-alarm/code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Code

Let's add code so that whenever we touch our face unnecessary so we will be alarmed.

From the [Make](/projects/face-touch-alarm/make.md) project, we know that Whenever the micro: bit detects the up gesture then it will show the sad face led light and warns the user, not to touch your face. Next, we build it more accurately as there can be some issues with shake gestures so we used comparisons. We are comparing the actual acceleration in X and Y directions that the micro: bit is experiencing and we are comparing it with a number or distance so if the acceleration is greater than that particular number it will warn the user not to touch your face. This will fine-tune how easily the micro: bit triggers by changing the values.

## Code your face-touch-alarm-warning-system

Download this code to your micro:bit. It will show a sad face on micro:bit whenever touched unnecessarily.

```blocks
basic.forever(function on_forever() {
if (input.acceleration(Dimension.X) > 550) {
basic.showIcon(IconNames.Sad)
} else if (input.acceleration(Dimension.Y) > 550) {
basic.showIcon(IconNames.Sad)
} else {
basic.clearScreen()
}
})
```
38 changes: 38 additions & 0 deletions docs/projects/face-touch-alarm/make.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Make

If you are prone to oily skin, face touching can aggravate the presence of skin oil, To help prevent infections, keep your hands away from your eyes, nose, and mouth so here micro:bit can help a lot.

We will build a **Face Touch Early Warning System** that warns you by showing led signals whenever you bring your hands towards your face.

## How it Works?

We are going to use an inbuilt accelerometer present in Microbit to know which side the micro bit is facing. I have used the MakeCode online editor. A micro bit can detect a bunch of gestures but we have used the OnShake gesture. Whenever the micro: bit detects the up gesture then it will show the sad face led light and warns the user, not to touch your face. Next, we build it more accurately as there can be some issues with shake gestures so we used comparisons. We are comparing the actual acceleration in X and Y directions that the micro: bit is experiencing and we are comparing it with a number or distance so if the acceleration is greater than that particular number it will warn the user not to touch your face. This will fine-tune how easily the micro: bit triggers by changing the values.

## Materials you need

* micro:bit and optional battery pack
* An elastic band

## How to build

Watch this video to see how to use micro:bit as a warning system

https://youtu.be/q9-CCeBNZ4Y

Below are some pictures of the components and connections

![Components Required](/static/mb/projects/face-touch-alarm/alarm-components.jpg)

Here are two pictures of the finished projects with its connections:

![Face touch alarm project 1](/static/mb/projects/face-touch-alarm/alarm-connection.jpg)

![Face touch alarm project 2](/static/mb/projects/face-touch-alarm/alarm-connection2.jpg)

Let's go on to code the micro:bit!

### ~button /projects/face-touch-alarm/code

Code

### ~
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.