Skip to content
The gator:soil is an analog based sensor capable of reading the moisture level of some dirt to tell you how wet it is, and consequentially, when you need to water your plants.
TypeScript Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode
.gitignore
LICENSE
Makefile
README.md
enums.d.ts
gatorsoil.ts
icon.png
pxt.json
shims.d.ts
test.ts
tsconfig.json

README.md

gator:soil Soil Moisture Sensor

Community Discord

The gator:soil, which can be used to read the moisture of soil can be purchased here.

SparkFun gator:soil

~ hint

To use this package, go to https://makecode.microbit.org, click Add package and search for gator-soil. The package is located here

~

Basic usage

//Grabs moisture from the sensor connected to pin P1, powering it using pin P0 to avoid corrosion on the moisture sensing leads.
gatorMoisture.moisture(AnalogPin.P1, gatorMoistureType.adcVal, DigitalPin.P0)

Use ||Get moisture on pin P0 in adcVal using power pin P0|| to read the moisture value either as a value between 0 and 1 or the straight ADC value.

Example: Moisture Sensor

//Read moisture value and write to screen every 60 seconds
basic.forever(function () {
    basic.showNumber(gatorMoisture.moisture(AnalogPin.P1, gatorMoistureType.adcVal, DigitalPin.P0))
    control.waitMicros(60000000)
})

Supported targets

  • for PXT/microbit

License

MIT

gatorSoil=github:sparkfun/pxt-gator-soil
You can’t perform that action at this time.