Multiple soil readings in variable then math

Hi all,

I’m Ian a teacher from the Netherlands and work at Yuverta Gouda. I started working on the farmbot and have soil reading questions. is it possible to have like 3 readings placed in variables and then do a math on it ? Regards Ian

Hi @imcassels and Welcome !

Sounds like you want the Farmbot device to do the math on some sensor readings ?

You could write some Lua script to do this, but it won’t be very concise as there seems to be no function to specifically fetch saved Sensor Readings in Lua right now ( ? submit a Feature Request )

You can also do this from any computer (not connected to your bot) by making Web API requests to get your Sensor Readings. Use any language that supports https:// requests and can parse the returned JSON object. Even the curl utility can fetch the raw JSON.

1 Like

A script in a Lua sequence step could do something like this:

value_0 = read_pin(pin_59, "analog")
value_1 = read_pin(pin_59, "analog")
value_2 = read_pin(pin_59, "analog")
value = (value_0 + value_1 + value_2) / 3

where movements or other actions or pauses could take place between readings if desired.

Those steps may only shed light on the repeatability of the sensor on pin_59 since the analog samples are taken at the highest possible rate . . or should the example have move’s interlaced ? :slight_smile: I Assumed the OP wanted to process older (stored) readings :slightly_frowning_face:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.