Index:
Finch
Class Finch
The Finch class contains methods necessary to connect to, read from, and set actuators on the Finch robot.
Author: Daragh Egan
Public:
Methods:
Public Sub buzz ( ByVal duration As UInt16, ByVal frequency As UInt16 )
Public Sub connect ( )
Public Function getAccelerations ( ) As Double ( )
Public Function getLeftLightSensor ( ) As Integer
Public Function getLightSensors ( ) As Integer ( )
Public Function getObstacleSensors ( ) As Boolean ( )
Public Function getRightLightSensor ( ) As Integer
Public Function getTemperature ( ) As Double
Public Function getXAcceleration ( ) As Double
Public Function getYAcceleration ( ) As Double
Public Function getZAcceleration ( ) As Double
Public Function isBeakDown ( ) As Boolean
Public Function isBeakUp ( ) As Boolean
Public Function isConnected ( ) As Boolean
Public Function isFinchLevel ( ) As Boolean
Public Function isFinchUpsideDown ( ) As Boolean
Public Function isLeftLightSensor ( ByVal limit As Integer ) As Boolean
Public Function isLeftWingDown ( ) As Boolean
Public Function isObstacle ( ) As Boolean
Public Function isObstacleLeftside ( ) As Boolean
Public Function isObstacleRightSide ( ) As Boolean
Public Function isRightLightSensor ( ByVal limit As Integer ) As Boolean
Public Function isRightWingDown ( ) As Boolean
Public Function isShaken ( ) As Boolean
Public Function isTapped ( ) As Boolean
Public Function isTemperature ( ByVal limit As Double ) As Boolean
Public Sub New ( )
Public Sub quit ( )
Public Function sendData ( ByVal writeBuffer ( ) As Byte, ByVal hasReply As Boolean ) As Byte ( )
Public Sub setLED ( ByVal red As UInteger, ByVal green As UInteger, ByVal blue As UInteger, ByVal duration As UInteger )
Public Sub setLED ( ByVal red As UInteger, ByVal green As UInteger, ByVal blue As UInteger )
Public Sub setWheelVelocities ( ByVal leftvelocity As Integer, ByVal rightvelocity As Integer )
Public Sub setWheelVelocities ( ByVal leftVelocity As Integer, ByVal rightVelocity As Integer, ByVal duration As UInteger )
Public Sub sleep ( ByVal ms As UInteger )
Public Sub startBuzz ( ByVal frequency As Int16 )
Public Sub stopBuzz ( )
Public Sub stopWheels ( )
Documentation:
Public Sub buzz ( ByVal duration As UInt16, ByVal frequency As UInt16 )
Plays the buzzer for a length of time at a frequency.
- duration - Duration of buzz in milliseconds.
- frequency - Frequency of buzz.
module| index| back| top
Public Sub connect ( )
Tries to connect to the finch.
Called automatically when Finch is initialized.
module| index| back| top
Public Function getAccelerations ( ) As Double ( )
Reads accelerometer values.
- Returns Double() - Array of three integers: x, y, and z values.
module| index| back| top
Public Function getLeftLightSensor ( ) As Integer
Returns the value of the left light sensor.
- Returns Integer - Intensity of light falling on left sensor (range is 0 to 255).
module| index| back| top
Public Function getLightSensors ( ) As Integer ( )
Gets values being read by the light sensors.
- Returns Integer() - Array of two integers: left and right sensors. Intesity of light (0-255).
module| index| back| top
Public Function getObstacleSensors ( ) As Boolean ( )
Reads obstacle sensors.
- Returns Boolean() - Array of two booleans: left and right sensors. True if object is present, false if not.
module| index| back| top
Public Function getRightLightSensor ( ) As Integer
Returns the value of the right light sensor.
- Returns Integer - Intensity of light falling on left sensor (range is 0 to 255).
module| index| back| top
Public Function getTemperature ( ) As Double
Reads temperature as measured by Finchs nose sensor.
- Returns Double - Temperature in Celcius.
module| index| back| top
Public Function getXAcceleration ( ) As Double
Returns the acceleration experienced by the Finch on the X axis.
- Returns Double - Acceleration in gees (range is -1.5 to 1.5).
module| index| back| top
Public Function getYAcceleration ( ) As Double
Returns the acceleration experienced by the Finch on the Y axis.
- Returns Double - Acceleration in gees (range is -1.5 to 1.5).
module| index| back| top
Public Function getZAcceleration ( ) As Double
Returns the acceleration experienced bt the Finch on the Z axis.
- Returns Double - Acceleration in gees (range is -1.5 to 1.5).
module| index| back| top
Public Function isBeakDown ( ) As Boolean
Uses the accelerometer to determine orientation.
- Returns Boolean - True if beak is facing down, false otherwise.
module| index| back| top
Public Function isBeakUp ( ) As Boolean
Uses the accelerometer to determine orientation.
- Returns Boolean - True if beak is facing up, false otherwise.
module| index| back| top
Public Function isConnected ( ) As Boolean
Check Finch connection status
- Returns Boolean - True if connected, false otherwise.
module| index| back| top
Public Function isFinchLevel ( ) As Boolean
Uses the accelerometer to determine orientation.
- Returns Boolean - True if Finch is flat on a surface, false otherwise.
module| index| back| top
Public Function isFinchUpsideDown ( ) As Boolean
Uses the accelerometer to determine orientation.
- Returns Boolean - True if Finch is upside down, false otherwise.
module| index| back| top
Public Function isLeftLightSensor ( ByVal limit As Integer ) As Boolean
Simple way to test the left light sensors value against a limit.
- limit - The value to test the light sensor against
- Returns Boolean - True if the left light sensor is less than the value specified, false otherwise.
module| index| back| top
Public Function isLeftWingDown ( ) As Boolean
Uses the accelerometer to determine orientation.
- Returns Boolean - True if the left wing is down, false otherwise.
module| index| back| top
Public Function isObstacle ( ) As Boolean
Simple check to see if there is an obstacle detected.
- Returns Boolean - true if an obstacle is detected on the left OR right side, false otherwise.
module| index| back| top
Public Function isObstacleLeftside ( ) As Boolean
Checks the left obstacle sensor.
- Returns Boolean - True if an obstacle is detected on the left side, false otherwise.
module| index| back| top
Public Function isObstacleRightSide ( ) As Boolean
Checks the right obstacle sensor.
- Returns Boolean - True if an obstacle is detected on the right side, false otherwise.
module| index| back| top
Public Function isRightLightSensor ( ByVal limit As Integer ) As Boolean
Simple way to test the right light sensors value against a limit.
- limit - The value to test the light sensor against
- Returns Boolean - True if the right light sensor is less than the value specified, false otherwise.
module| index| back| top
Public Function isRightWingDown ( ) As Boolean
Uses the accelerometer to determine orientation.
- Returns Boolean - True if right wing is down, false otherwise.
module| index| back| top
Public Function isShaken ( ) As Boolean
Checks whether Finch has been shaken recently.
- Returns Boolean - True if the Finch has been shaken recently.
module| index| back| top
Public Function isTapped ( ) As Boolean
Checks if the accelerometer detected a tap recently.
- Returns Boolean - True if the Finch has been tapped recently.
module| index| back| top
Public Function isTemperature ( ByVal limit As Double ) As Boolean
Checks the current temperature against a value.
- limit - The value to check temperature against
- Returns Boolean - True if the temperature is less than the specified value, false otherwise.
module| index| back| top
Public Sub quit ( )
Disconnects the Finch from the application and returns it to idle mode.
module| index| back| top
Public Function sendData ( ByVal writeBuffer ( ) As Byte, ByVal hasReply As Boolean ) As Byte ( )
Sends an array of 9 bytes to the finch as output.
Returns input from Finch only if hasReply is True.
- writeBuffer - Ouput to send to Finch.
- hasReply - Tells the function whether or not to expect and return input data.
- Returns Byte() - Array of bytes from the Finch if requested.
module| index| back| top
Public Sub setLED ( ByVal red As UInteger, ByVal green As UInteger, ByVal blue As UInteger, ByVal duration As UInteger )
Sets the LED for an amount of time.
- red - Red value (1 byte)
- green - Green value (1 byte)
- blue - Blue value (1 byte)
- duration - Time to hold in milliseconds.
module| index| back| top
Public Sub setLED ( ByVal red As UInteger, ByVal green As UInteger, ByVal blue As UInteger )
Sets the LED to the specified color.
- red - Red value (1 byte)
- green - Green value (1 byte)
- blue - Blue value (1 byte)
module| index| back| top
Public Sub setWheelVelocities ( ByVal leftvelocity As Integer, ByVal rightvelocity As Integer )
Moves left and right motors. Positive values are forward and negative values are backward.
- leftvelocity - Speed between -255 and 255.
- rightvelocity - Speed between -255 and 255.
module| index| back| top
Public Sub setWheelVelocities ( ByVal leftVelocity As Integer, ByVal rightVelocity As Integer, ByVal duration As UInteger )
Moves the left and right motors for a duration of time.
- leftVelocity - Speed between -255 and 255.
- rightVelocity - Speed between -255 and 255.
- duration - Time to hold in milliseconds.
module| index| back| top
Public Sub sleep ( ByVal ms As UInteger )
Pauses the current thread.
- ms - Duration is milliseconds.
module| index| back| top
Public Sub startBuzz ( ByVal frequency As Int16 )
Turn the buzzer on until stopBuzz is called.
- frequency - The frequency in Hertz to set the buzzer to.
module| index| back| top
Public Sub stopBuzz ( )
Turn the buzzer off.
module| index| back| top
Public Sub stopWheels ( )
Sets the wheel velocities to zero.
module| index| back| top