boat

Hardware and software

Logic Gates - logic statements

An environmental scientist uses sensors to gather data from a river.

  • pH sensor : to monitor the pH of the river water.
  • temperature sensor : to monitor the temperature of the river water.
  • gas sensor : to monitor the level of oxygen in the river water.

Using ANALOGUE-TO-DIGITAL converters (ADC), analogue data from the sensors is converted into digital signals and processed by a microprocessor.

The following table describes the digital signals that are generated by the ADC according to the state of the river:

sensor condition binary value
ph >5 1
<=6 0
temp <=15oC 0
>15oC 1
gas normal 1
abnormal 0

A digital circuit must now be designed such that the alarm will sound if both

The pH level is less than 6 or the gas level is abnormal

and

The temperature is greater than 15oC

Task 1

Use circuitverse to design the circuit.

We can represent the logic required to solve these kinds of puzzles by producing logic statments.

A logic statement describes the output of a system. It uses the logical operators and, or, nand, nor, exor and not to describe how the system's input(s) produce the system's output(s).

For example, in the above circuit, the output will be 1 if:

(pH is 0 OR gas is 0) AND temp is 1

To further codify how to write logic statements, we can replace temp = 1 with simply temp.

We can also replace the statement gas is 0 with NOT gas

So the above statement can be written as:

(NOT pH OR NOT gas) AND temp

To make it clear that the output will be 1 if the above condition is true, the full expression is often written as:

OUTPUT = (NOT pH OR NOT gas) AND temp

Welcome to the hard stuff

OOP may be very unfamiliar to you. This will make it seem very difficult.

Experience will help you.

Struggling will help you.

Asking questions will help you.

Developing your English skills will help you!

Understanding the Data Type you are working with will help you - eg Student, Elephant[], ArrayList Hammer, String...