NXShield  v1.07
NXShield Library Reference by OpenElectrons.com
 All Classes Files Functions Variables Enumerations Enumerator Macros Pages
NXTUS Class Reference

This class interfaces with LEGO Ultrasonic sensor attached to NXShield. More...

#include <NXTUS.h>

Inheritance diagram for NXTUS:
SoftI2cMaster

Public Member Functions

 NXTUS (uint8_t devAddr=0x02)
 
void init (NXShield *shield, SH_BankPort bp=SH_BBS2)
 
uint8_t getDist ()
 
char * getFirmwareVersion ()
 
char * getVendorID ()
 
char * getDeviceID ()
 
- Public Member Functions inherited from SoftI2cMaster
uint8_t start (uint8_t addressRW)
 
void stop (void)
 
uint8_t restart (uint8_t addressRW)
 
uint8_t write (uint8_t b)
 
uint8_t read (uint8_t last)
 
 SoftI2cMaster (uint8_t devAddr)
 
void initProtocol (uint8_t sclPin=NULL, uint8_t sdaPin=NULL)
 
uint8_t * readRegisters (uint8_t startRegister, uint8_t bytes, uint8_t *buf=NULL)
 
bool writeRegistersWithLocation (int bytes, uint8_t *buf)
 
bool writeRegisters (uint8_t location, uint8_t bytes_to_write, uint8_t *buffer=0)
 
bool writeByte (uint8_t location, uint8_t data)
 
bool writeInteger (uint8_t location, uint16_t data)
 
bool writeLong (uint8_t location, uint32_t data)
 
char * readString (uint8_t startRegister, uint8_t bytes, uint8_t *buf=NULL, uint8_t len=0)
 
uint8_t readByte (uint8_t location)
 
int16_t readInteger (uint8_t location)
 
uint32_t readLong (uint8_t location)
 
char * getFirmwareVersion ()
 
char * getVendorID ()
 
char * getDeviceID ()
 
uint8_t getWriteErrorCode ()
 
bool checkAddress ()
 
bool setAddress (uint8_t address)
 

Additional Inherited Members

- Public Attributes inherited from SoftI2cMaster
uint8_t * _so_buffer
 

Detailed Description

This class interfaces with LEGO Ultrasonic sensor attached to NXShield.

Constructor & Destructor Documentation

NXTUS::NXTUS ( uint8_t  devAddr = 0x02)

class constructor for NXTUS with default i2c address that cannot be changed

Member Function Documentation

char * NXTUS::getDeviceID ( )

get the device name of the NXTUS

uint8_t NXTUS::getDist ( )

get the distance from the NXTUS in millimeters

char * NXTUS::getFirmwareVersion ( )

get the firmware version of the NXTUS

char * NXTUS::getVendorID ( )

get the vendor name of the NXTUS

void NXTUS::init ( NXShield shield,
SH_BankPort  bp = SH_BBS2 
)

initialize the NXTUS on the specified NXShield and bankport


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