Jump to content

Component: Sound Sensor (Grove 101020023) (101020023) (Audio)

From Flowcode Help
Revision as of 10:36, 17 November 2021 by Wiki bot (talk | contribs)
Author Matrix Ltd
Version 1.0
Category Audio


Sound Sensor (Grove 101020023) component

The Sound sensor module is a simple microphone. Based on the power amplifier LM386 and the electret microphone, it can be used to detect the sound strength of the environment.

Detailed description

No detailed description exists yet for this component

Examples

No additional examples


Downloadable macro reference

GetString
Reads the ADC as a direct voltage and returns as as tring 
- STRING Return


GetAverageByte
Function call to read the ADC as a byte average sample over time  
- BYTE NumSamples
 
- BYTE DelayUs
Number of micro seconds in between taking each sample 
- BYTE Return


GetAverageInt
Function call to read the ADC as a full width average sample over time  
- BYTE NumSamples
 
- BYTE DelayUs
Number of micro seconds in between taking each sample 
- UINT Return


GetVoltage
Reads the ADC as a direct voltage 
[[File:]] - Return


GetInt
Blocking call to read the ADC at full bit depth  
- UINT Return


GetByte
Blocking call to read the ADC as a byte  
- BYTE Return


GetInt
Blocking call to read the ADC at full bit depth  
- UINT Return


GetByte
Blocking call to read the ADC as a byte  
- BYTE Return


Initialise
Initialise the sensor configuration as set by the component properties. Sets the default intigration time and gain as well as enable the sensor. 
- VOID Return


Initialise
Configures the I2C peripheral and puts the sensor into one shot mode ready to be sampled. Must be called before calling any of the other component macros. Returns 1 if the sensor has been intialised correctly, else returns 0. 
- BYTE Return


Initialise
Starts up the I2C bus and initialises the pressure sensor ready for use. Returns 1 for a sucessful startup. Returns 0 for a failed startup or no device detected. 
- BYTE Return


Initialise
Sets up the GSM module. Returns 0 for OK, 255 for no reply and 254 for command fail. 
- BYTE Return


SampleAccel
Samples the accelerometer 0 = no new data, 1 = new data available 
- BYTE Return


Left
Rotates the robot left - waits for the angle to be traversed before returning 
- UINT Angle
Angle to turn in degrees 
- VOID Return


ReadIR
Reads an IR sensor 0=Left, 1=FrontLeft, 2=Front, 3=FrontRight, 4=Right, 5=RearRight, 6=Rear, 7=RearLeft 
- BYTE index
0=Left, 1=FrontLeft, 2=Front, 3=FrontRight, 4=Right, 5=RearRight, 6=Rear, 7=RearLeft 
- UINT Return


LCDDrawPixel
Allows a single pixel on the LCD to be set or cleared 
- BYTE X
X Pixel 0-127 
- BYTE Y
Y Pixel 0-31 
- BYTE State
0=White (Off), 1=Black (On) 
- VOID Return


ServoSetPosition
Allows one of the servo positions to be assigned 
- BYTE Channel
Range 0-3 
- BYTE Position
Range 0-255 
- VOID Return


CardBitmap
Displays a monochrome bitmap read from the card on the LCD 
- BYTE X
Range 0-127 
- BYTE Y
Range 0-31 
- STRING Filename
 
- BYTE Return


CardRecordMic
Records an audio stream on the card from the microphone 
- BYTE BitDepth
0=8-bit, 1=16-bit 
- BYTE SampleRate
Sample Rate 0=8KHz, 1=16KHz 
- UINT RecordTime
Time to record for in seconds, Range 0-65535 
- STRING Filename
 
- BYTE Return


CardOpen
Attempts to open an existing file on the SD card 255=Error, 1=File not found, 0=Open OK 
- STRING Filename
 
- BYTE Return


Forwards
Drives the robot forwards - waits for the distance to be traversed before returning 
- UINT Distance
Distance in mm 
- VOID Return


ReadBearing
Reads the compass bearing based on the degrees clockwise from magnetic north. 
[[File:]] - Return


GetConsoleHandle
Gets the handle to the console allowing data displaying on the panel etc. 
[[File:]] - Return


LCDDrawLine
Allows a single pixel width line to be drawn on the LCD 
- BYTE X1
X Pixel 0-127 
- BYTE Y1
Y Pixel 0-31 
- BYTE X2
X Pixel 0-127 
- BYTE Y2
Y Pixel 0-31 
- VOID Return


ServoAutoMoveToPosition
Allows one of the servo positions to move gradually to a new position 
- BYTE Channel
Range 0-3 
- BYTE Position
Range 0-255 
- VOID Return


ReadAllValue
Reads a single value stored from the read all command Index dictates which sensor value to read 
- BYTE Index
0=SW, 1-8=IR, 9-10=Line, 11=Light, 12=Mic, 13-15=Accel 
- UINT Return


LCDBacklight
Allows the LCD backlight brighntess to be adjusted 
- BYTE Intensity
Range 0-100, 0=Off, 1=Min Brightness, 100=Max Brightness 
- VOID Return


LCDDrawRect
Allows a rectangle to be drawn on the LCD 
- BYTE X1
X Pixel 0-127 
- BYTE Y1
Y Pixel 0-31 
- BYTE X2
X Pixel 0-127 
- BYTE Y2
Y Pixel 0-31 
- VOID Return


ReadLine
Reads one of the IR line sensors 0-1 0=Left, 1=Right 
- BYTE index
0=Left, 1=Right 
- UINT Return


ServoDisable
Allows one of the servo outputs 0-3 to be disabled 
- BYTE Channel
Range 0-3 
- VOID Return


ServoEnable
Allows one of the servo outputs 0-3 to be enabled 
- BYTE Channel
Range 0-3 
- VOID Return


CardReadByte
Reads a byte from the currently open file. Starts at the beginning of the file and auto increments to the end 
- BYTE Return


CardErase
Attempts to delete an existing file on the SD card 255=Error, 1=File not found, 0=Delete OK 
- STRING Filename
 
- BYTE Return


CardWriteByte
Appends a byte to the end of the currently open file  
- BYTE Data
 
- VOID Return


EncoderRead
Reads one of the motor encoder counters. Approx 0.328296mm of travel per encoder unit. 
- BYTE index
0=Left, 1=Right 
- UINT Return


SetMotors
Sets the motor speeds without feedback Range -100 to 100 
[[File:]] - Left
Range -100 to 100 
[[File:]] - Right
Range -100 to 100 
- VOID Return


Backwards
Drives the robot backwards - waits for the distance to be traversed before returning 
- UINT Distance
Distance in mm 
- VOID Return


EncoderReset
Resets the motor encoder counters 
- VOID Return


LCDVerbose
Allows the LCD to automatically report the API commands as they get processed. Default - verbose on 
- BYTE State
0=Off 1=On 
- VOID Return


SetProp
Allows the COM port property to be set from a parent component. 
- STRING PropName
 
- ULONG PropVal
 
- VOID Return


CardInit
Attempts to startup the SD card 255=No Card, 254=Init Fail, 0=Init OK 
- BYTE Return


GetProp
Allows the property filter for the COM port list to be copied to a parent component. 
- STRING PropName
 
- STRING Return


LCDClear
Clears the LCD 
- VOID Return



Property reference

Properties
VRef voltage
Used by the GetVoltage or GetString component macros to take an ADC reading and convert it into a Voltage. +VRef voltage x 10mV Default 500 = 5.0V  
VRef option
Defines what is used as the ADC maximum reference. ADC Range = GND to VRef Voltage. VDD - Defines the microcontrollers power supply pin as the max reference, VREF+ Pin - Dedicated pin on the microcontroller to allow for a variable reference voltage.  
Conversion speed
Clock setting to select how fast the ADC peripheral will perform an ADC conversion. The FRC setting is based on a RC time base and so will vary with temperature and pressure. Other settings are generally based on divisions of the master clock.  
Aquisition cycles
Number of micro seconds to wait for the ACD input to charge before starting the analogue sample. 
Bit Depth
Maximum number of digital bits the ADC can sample. 8 bit = ADC range 0 - 255 10 bit = ADC range 0 - 1023 12 bit = ADC range 0 - 4095  
Connections
Channel
Analogue input channel - which pin is the analogue input conected to? 
Simulations
Tang Color
Colour of the moving part of the slider. 
Marker Color
Colour of the marker line across the slider tang. 
Scope Traces
Selects if the scope traces are automatically generated or not