node-red-contrib-node-stemhat
v1.0.1
Published
Basic Node-RED node for STEM HAT
Downloads
6
Readme
node-stemhat
A set of Node-RED nodes that is able to be used by the STEM HAT hardware to output digital and analog signals and read digital and analog signals.
Installation
npm i node-red-contrib-node-stemhat
Common Usage
This package of nodes includes 10 types of nodes, which are STEM HAT LED, STEM HAT Servo, STEM HAT Motor, STEM HAT Light Sensor, STEM HAT Vin Voltage, STEM HAT Analog in, STEM HAT Buzzer, STEM HAT GPIO OUT, STEM HAT GPIO IN and STEM HAT Ultrasonic.
Analog Output Nodes
The analog output nodes are nodes that gives out analog output to the hardware with value in a certain range.
STEM HAT LED
STEM HAT LED output node gives out analog output from range of 0 to 255. User can choose between RGB0 with colour red, green or blue and RGB1 with colour red, green or blue. When increasing the value of input, the LED with light up brighter. If the input to the node is not between the range of 0 to 255, there will not be any response from the LED.
STEM HAT Servo
STEM HAT Servo output node gives out analog output from range of 0 to 180, where the default value is 90. User can choose between servo 1, servo 2, servo 3, and servo 4. The input value is representing the angle of rotation of the servo motor. If the input to the node is not between the range of 0 to 180, there will not be any response from the servo motor.
STEM HAT Motor
STEM HAT Motor output node gives out analog output from range of -255 to 255. User can choose between motor 1 and motor 2. The input value is representing the speed of the motor and the positive value represent postitve rotation and negative value represent negative rotation. If the input to the node is not between the range of -255 to 255, there will not be any response from the motor.
Analog Input Nodes
The analog input nodes are nodes that reads analog data from the hardware and communicate using i2c bus to get the value.
STEM HAT Light Sensor
The sensor will read the light intensity of the environment and give out a value ranging from 0 to 255.
STEM HAT Vin Voltage
The pin will read the voltage input value and give out a value ranging from 0 to 255. The input voltage is equivalent to the output value divided by 10.
STEM HAT Analog In
User can choose between the pins AN0 and AN1. The pin will read the input data from the pin and give out a value ranging from 0 to 255.
Digital Output Nodes
The digital ouput nodes are nodes that gives out digital output with either 0 or 1 (or true or false).
STEM HAT Buzzer
When the output is 0 or false, the buzzer will not sound. When the output is 1 or true, the buzzer will produce a 'beep' sound.
STEM HAT GPIO OUT
User can choose between the pins GPIO 12 and GPIO 13. The output will be sent to the device that are connected to the corresponding output pins.
Digital Input Nodes
The digital input nodes are nodes that will read the state of the pins that are selected and generates a msg.payload with either 0 or 1 depending on the state of the pins.
STEM HAT GPIO IN
User can choose between the pins GPIO 5, GPIO 6, GPIO 12 and GPIO 13. When selected, the node will read the state of the selected pin.
STEM HAT Ultrasonic
STEM HAT Ultrasonic input node requires a 4 pin ultrasonic sensor. Generates a msg.payload representing the distance in centimeters according the time between the trigger and echo.