update serial port permission when dev on local PC
sudo chmod 666 /dev/ttyUSB0
using this api you can write a value to a node without having to download/deploy a new flow
method
HTTP-POST
url
http://0.0.0.0:1665/api/nodes/payload/NODE-ID
body a float value
{
"float": 2
}
body a bool value
{
"boolean": true
}
body a string value
{
"string": "abc"
}
body as an interface
{
"any": [1,2,3,4]
}
func (inst *Not) Process() {
in, null := inst.ReadPinBoolOk(node.Inp)
if null { // if input is null then set output to nil
inst.WritePinNull(node.Outp)
return
}
if in {
inst.WritePinFalse(node.Outp)
} else {
inst.WritePinTrue(node.Outp)
}
}
inst.ReadPinFloat(name InputName) (value float46, null bool) // will return the value as a float and if its `null/nil` the `boolean` `null` flag will be `true`
inst.ReadPinBool(name InputName) (value bool, null bool) // same as above but value is a boolean
inst.WritePinFloat(node.Outp, f, inst.precision) // you can add number of decimal places
inst.WritePinFloat(name OutputName, value float64) // set output to number value (float64)
inst.WritePinNull(node.Outp) // set output to nil
inst.WritePinTrue(node.Outp) // set output to true
inst.WritePinFalse(node.Outp) // set output to false
check if input value has been updated and boolCOV will let you know if an input went from false to true
InputUpdated(name InputName) (updated bool, boolCOV bool)
count, firstLoop := Loop()
if InputHasConnection(node.InBoolean) {
log.Infof("log: comment: %s boolean: %t", comment, inBool)
}
when a blocking function is need to be executed eg:(do a database call) a go-routine
can be used, see example below