BayEOSArduino Library
Functions
Waking Up and Talking To Sensors

These functions are needed to communicate with SDI-12 sensors (slaves) or an SDI-12 datalogger (master). More...

Functions

virtual size_t SDI12::write (uint8_t byte)
 Write out a byte on the SDI-12 line. More...
 
void SDI12::sendCommand (String &cmd, int8_t extraWakeTime=0)
 Send a command out on the data line, acting as a datalogger (master) More...
 
void SDI12::sendCommand (const char *cmd, int8_t extraWakeTime=0)
 
void SDI12::sendCommand (FlashString cmd, int8_t extraWakeTime=0)
 
void SDI12::sendResponse (String &resp)
 Send a response out on the data line (for slave use) More...
 
void SDI12::sendResponse (const char *resp)
 
void SDI12::sendResponse (FlashString resp)
 

Detailed Description

These functions are needed to communicate with SDI-12 sensors (slaves) or an SDI-12 datalogger (master).

Function Documentation

◆ sendCommand()

void SDI12::sendCommand ( String &  cmd,
int8_t  extraWakeTime = 0 
)

Send a command out on the data line, acting as a datalogger (master)

Parameters
cmdthe command to send

A publicly accessible function that sends a break to wake sensors and sends out a command byte by byte on the data line.

Parameters
extraWakeTimeThe amount of additional time in milliseconds that the sensor takes to wake before being ready to receive a command. Default is 0ms - meaning the sensor is ready for a command by the end of the 12ms break. Should be lower than 100.

◆ sendResponse()

void SDI12::sendResponse ( String &  resp)

Send a response out on the data line (for slave use)

Parameters
respthe response to send

A publicly accessible function that sends out an 8.33 ms marking and a response byte by byte on the data line. This is needed if the Arduino is acting as an SDI-12 device itself, not as a recorder for another SDI-12 device.

◆ write()

size_t SDI12::write ( uint8_t  byte)
virtual

Write out a byte on the SDI-12 line.

Parameters
byteThe character to write
Returns
size_t The number of characters written

Sets the state to transmitting, writes a character, and then sets the state back to listening. This function must be implemented as part of the Arduino Stream instance, but is NOT intenteded to be used for SDI-12 objects. Instead, use the SDI12::sendCommand() or SDI12::sendResponse() functions.