The float sensor is a sensor in the Smart Hydroponics Kit. It acts as a switch that opens and closes while placed in water, and can be programmed using the sensor port on the breakout board.

Float switch front angle

Important: Handling & Care

The float sensor works by submerging the plastic float module in water. If any element of the electronic components is accidentally wet, remove the project from water and allow it to completely dry before continuing use.

Do not put the float sensor away while it is wet; let it finish air drying before putting it back into the Smart Hydroponics Kit with the other components that are sensitive to water.

MakeCode Extension

Each time you use this component, you’ll need to add the extension to your MakeCode project. Depending on the type of kit you have, you can select one of the following extensions:

MakeCode Extensions Drawer

Create a new MakeCode File, and select the Extensions drawer from the toolbar.

Forward Education MakeCode extension for the Smart Hydroponics Kit

Search for smart-hydroponics by Forward Education, and add it to your project.

Sensors

Sensors Drawer Makecode

From the toolbar, select the sensors drawer, and scroll to the float category.

The blocks within this category are used to code the sensor input on the float sensor.

Float is Raised/Lowered

float is raised/lowered

A boolean block, which returns true or false compared to a user-selected value (a number). By default, the user-selected value is equal to 0.

Click the dropdown “Raised” to select “Lowered”.

Raised

  • True: The sensor is raised.
  • False: The sensor is lowered.

Lowered

  • True: The sensor is lowered.
  • False: The sensor is raised.

Float State

Float state

A reporter block, which returns a number based on the sensor’s position.

  • 0 = Lowered
  • 1 = Raised

On Float

on float raised / lowered event

An event block, which triggers when the float sensor is interacted with.

  • Raised: Triggers the event as the sensor is raised.
  • Lowered: Triggers the event as the sensor is lowered.

Click the dropdown “Raised” to select “Lowered”

Related Content

Feeling Stuck? Explore the Knowledge Base for common questions and troubleshooting tips.