1 of 14

C9 : Water Tank full code

Electricity bases

2 of 14

C9 : Water Tank full code

Electricity bases

3 of 14

A special think about LOGIC GATES

https://en.wikipedia.org/wiki/Logic_gate

4 of 14

Why is LOGIC GATES interesting? our system might be only a logic gates circuit

5 of 14

CONTEXT

high sensor

low sensor

Pump

Ground Reserve

Motion sensor

low sensor

6 of 14

Water tank ALGORYTHMIC VIEW

MAIN PROCESS

GOAL = Maintien water level on the water tank

We have 3 CASE to manage : -CASE 1 : water full everywhere

-CASE 2 : water in reserve but water tank is empty

-CASE 3 : Reserve is empty

7 of 14

Water tank

MAIN CODE STRUCTURE

WHILE (lowSensor==True && hightSensor==True)

WAIT…

ELIF (lowSensor== True && hightSensor==False)

PumpWater ON

ELSE

Print Alert Level Notification

8 of 14

Water tank

WHAT WE DO DURING WAIT TIME ????

We are waiting for orders, check the system on, give notifications, etc

Your client is rich… he wants to … his friends!

His wishes are now:

-Have a control

Wants to be notified if empty reserve

Mesure consomation

Send an email to order a water Truck

Detect any intrusion

Make a log on file recorded everyday, and tap in his hand to shut on the light!! :))

9 of 14

Water tank

Wich libraries do we need?

We are waiting for orders, check the system on, give notifications, etc

You have to think about those things and make an inventory about all libraries you needs.

-manage GPIO LIB = ….

manage motionDetector LIB = ….

-send emails LIB = ….

make and write data on a file LIB = ….

use an external microphone LIB = …

Speak if possible LIB = ….

10 of 14

Water tank

Create a code by yourself

Get informed about libraries

Make test on functions you want to use

keep your boots code (only once working)

Write the MAIN algorithm on paper or note

Detail your lines using each boot code you kept..

11 of 14

Water tank

Create a code by yourself

Make tests by runnings during all your composition

you will have many disapointments

many breaks

And sometines will take an important step

12 of 14

Water tank

Create a code by yourself

Mind to record regularly your code on the disk

Each step when it works as well

And create versions, like myCode1.1

Then myCode1.2

Etc…

13 of 14

Water tank

Create a code by yourself

Using internet you can find many examples

Inside lessons, forum topics, but most in library banks

When you are blocked

You can copy and paste your error into a google search

It’s a good way to resolve everything

14 of 14

SUGGESTS LINKS :