GP3/Arduino
|
The main class for the I/O board. More...
#include <gp3.h>
Public Member Functions | |
GP3 (int rx, int tx) | |
GP3 (Stream &port) | |
~GP3 () | |
int | getError (void) |
void | clearError (void) |
Clear any errors. | |
int | readByte (void) |
unsigned int | readWord (void) |
void | setLED (boolean onoff) |
Set the LED on (true) or off (false) | |
unsigned int | a2d () |
void | a2dChan (int chan) |
void | a2dConf (bool rightjustify, int cselect) |
void | high (int pin) |
Set a digital output pin high. | |
void | low (int pin) |
Set a digital output pin low. | |
void | toggle (int pin) |
Toggle a digital output pin (set high if low, low if high) | |
int | input (int pin) |
Get an input from a digital pin. | |
void | setTris (int tris) |
Set the port I/O bits all at once. | |
int | getTris (void) |
Get the port I/O bits. | |
void | setPins (int byte) |
Set all output bits at once. | |
int | getPins (void) |
Get all input bits at once. | |
void | writeEE (int address, int byte) |
Write to EEPROM. | |
int | readEE (int address) |
Read from EEPROM. | |
void | pwm (int chan, int dc, int dfreq) |
unsigned int | count (int pin, unsigned int ms) |
Count events on a pin over a specified number of milliseconds. | |
unsigned int | rcTime (int pin, int state) |
Perform an RC timing algorithm on a pin (see GP3 manual) | |
unsigned int | pulseIn (int pin, int state) |
Measure a pulse width. | |
void | pulseOut (int pin, int duration) |
Create a pulse of a given duration. | |
void | freq (int pin, int ms, int frq) |
Output a frequency. | |
void | setCounter (int prescale, int ext) |
unsigned int | count () |
Get hardware counter value. | |
void | resetAll (void) |
Reset everything. | |
void | reset (void) |
Warm reset. | |
void | repeat (int count) |
void | argInc (void) |
Increment the arg. | |
void | argDec (void) |
Decrement the arg. | |
unsigned int | check (void) |
Check the GP3 status. Should return 51. | |
void | setTimeout (int _timeout) |
Set a communication timeout (default 100mS) | |
int | getTimeout (void) |
Get current communication timeout. | |
bool | listen (void) |
bool | isListening () |
The main class for the I/O board.
GP3::GP3 | ( | int | rx, |
int | tx | ||
) |
Construct a GP3 object with a SoftwareSerial port NOTE: Not available in port version
GP3::GP3 | ( | Stream & | _port | ) |
Construct a GP3 object with any port Note must be 57600 baud This is the port version's only constructor
GP3::~GP3 | ( | ) |
Clean up if using the default port If not using the default port you are on your own.
unsigned int GP3::a2d | ( | void | ) |
Get the analog value (0-1023) on the current channel
void GP3::a2dChan | ( | int | chan | ) |
Select an A/D channel (default=0) All subsequent calls to a2d will use this channel
void GP3::a2dConf | ( | bool | rightjustify, |
int | cselect | ||
) |
Configure A/D convert for right justification (default) and voltage reference Rarely used; see GP3 manual for details
int GP3::getError | ( | void | ) |
Returns non-zero if an error has occurred Never automatically cleared after construction
bool GP3::isListening | ( | ) |
Call the soft port's isListening function If using your own port, always returns false even if you are using a soft port Not available in the port version
bool GP3::listen | ( | void | ) |
Call the soft port's listen function If using your own port, always returns false even if you are using a soft port Not available in the port version
void GP3::pwm | ( | int | chan, |
int | dc, | ||
int | dfreq | ||
) |
Generate PWM Use chan=-1 for hardware channel
int GP3::readByte | ( | void | ) |
Read a byte from the GP3 with a timeout You usually do not call this directly Unless you are using repeat
unsigned int GP3::readWord | ( | void | ) |
Read a word from the GP3. Rarely called from a user program unless using repeat
void GP3::repeat | ( | int | count | ) |
The repeat command allows the next command to repeat over and you get the 2nd and later results using readword() or readbyte()
void GP3::setCounter | ( | int | prescale, |
int | ext | ||
) |
Set hardware counter prescaler and source Prescaler can be 1, 2, 4, or 8