RedBot
RedBot Arduino Library for the Sparkfun RedBot
 All Classes Functions Variables
RedBotSensor Class Reference

#include <RedBot.h>

Public Member Functions

 RedBotSensor (int pin)
 
int read ()
 
boolean check ()
 
int setBGLevel ()
 
int setDetectLevel ()
 

Detailed Description

A class for controlling the RedBot's sensors.

A single object of the class RedBotSensor is needed for each sensor that you want to use on the RedBot.

Constructor & Destructor Documentation

RedBotSensor::RedBotSensor ( int  pin)

Create a new object of the RedBotSensor class.

pin is the analog input pin that the sensor is connected to.

Usage Example:

#include <RedBot.h>

RedBotSensor sensor = RedBotSensor (A2);

Member Function Documentation

boolean RedBotSensor::check ( )

Determines if the current sensor reading is within the configured levels.

This method returns true if the sensor's current analog value is within the configured levels. If the sensor's current analog value is outside the configured levels, RedBotSensor::check() returns false.

int RedBotSensor::read ( )

Read the analog level of the sensor.

This method is primarily used when you want to do your own data processing instead of relying on the library's edge detection.

int RedBotSensor::setBGLevel ( )

Set the background/default sensor reading level.

Calling this method sets the sensor's reading level that corresponds to an uninteresting sensor reading. For example, if you are trying to follow a black line on a white background, you would call RedBotSensor::setBPLevel() when the light sensor is over the white background.

int RedBotSensor::setDetectLevel ( )

Set the forground/active sensor reading level.

Calling this method sets the sensor's reading level that corresponds to an interesting sensor reading. For example, if you are trying to follow a black line on a white background, you would call RedBotSensor::setDetectLevel() when the light sensor is over the black background.


The documentation for this class was generated from the following files: