Led question start

I am using the tree plum pie, I want another NODE-RED. At the beginning, the GPIO is OUTPUT and then the sensing component senses something. In the other original OUTPUT becomes INPUT, the first part is set to OUTPUT at the beginning. ?

And just what is a 'tree plum pie'?

and please describe your issue a little more as from my first read I have no idea what you are asking about. Give details! Providing your flow, providing a picture of your flow. Explain what type of sensor you are using.

應該是說,我想讓流程在一開始不會依靠inject來動作做一個觸動的動作,我想讓樹梅派的gpio腳位一開始就是保持vcc的狀態

It should be said that I hope this process does not rely on the injection action to initiate a touch action. I want the tree GPIO pin to maintain the VCC state at the beginning.

  1. What platform are you using? example Rpi, macOS, Windows
  2. What release of node-red and node.js? (you can get these from the node-red startup)
  3. export your flow and attach it to a response - make sure to use the preformated text option </>

Due to the language difference it is hard for me to understand your needs but I will do my best.


1)你使用什麼平台? 例如Rpi,macOS,Windows
2)什麼版本的node-red和node.js? (你可以從node-red啟動獲得這些)
3)導出您的流並將其附加到響應 - 確保使用預先格式化的文本選項</>

由於語言的差異,我很難理解你的需求,但我會盡我所能。

  1. Nǐ shǐyòng shénme píngtái? Lìrú Rpi,macOS,Windows
  2. shénme bǎnběn de node-red hé node.Js? (Nǐ kěyǐ cóng node-red qǐdòng huòdé zhèxiē)
  3. dǎochū nín de liú bìng jiāng qí fùjiā dào xiǎngyìng - quèbǎo shǐyòng yùxiān géshì huà de wénběn xuǎnxiàng </>

yóuyú yǔyán de chāyì, wǒ hěn nán lǐjiě nǐ de xūqiú, dàn wǒ huì jǐn wǒ suǒ néng.


Also, please do not open multiple threads for the same issue.

此外,請不要為同一問題打開多個線程。
Cǐwài, qǐng bùyào wèi tóngyī wèntí dǎkāi duō gè xiànchéng.

I was able to import your flow. Let me restate what I think you want.

When NR starts, you want GPIO pin 7 off. Later, you might have a sensor (or dashboard button) that should change the output state.

Have an INJECT node set to run at startup to set the GPIO pin to off. Then have a switch or sensor change it when you want.

Attached is a flow that will demonstrate show you how to do this.


我能夠導入你的流量。 讓我重申一下我的想法。

當NR啟動時,您需要關閉GPIO引腳7。 稍後,您可能有一個應該更改輸出狀態的傳感器(或儀表板按鈕)。

將INJECT節點設置為在啟動時運行,以將GPIO引腳設置為關閉。 然後讓開關或傳感器在需要時更換它。

附件是一個流程,將演示如何執行此操作。
Wǒ nénggòu dǎorù nǐ de liúliàng. Ràng wǒ chóngshēn yīxià wǒ de xiǎngfǎ.

Dāng NR qǐdòng shí, nín xūyào guānbì GPIO yǐn jiǎo 7. Shāo hòu, nín kěnéng yǒu yīgè yīnggāi gēnggǎi shūchū zhuàngtài de chuángǎnqì (huò yíbiǎo bǎn ànniǔ).

Jiāng INJECT jiédiǎn shèzhì wèi zài qǐdòng shí yùnxíng, yǐ jiāng GPIO yǐn jiǎo shèzhì wèi guānbì. Ránhòu ràng kāiguān huò chuángǎnqì zài xūyào shí gēnghuàn tā.

Fùjiàn shì yīgè liúchéng, jiāng yǎnshì rúhé zhíxíng cǐ cāozuò.

[{"id":"efc5858b.00243","type":"debug","z":"262bf5ee.33d85a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":630,"y":200,"wires":[]},{"id":"91a37427.551608","type":"rpi-gpio out","z":"262bf5ee.33d85a","name":"","pin":"7","set":false,"level":"0","freq":"","out":"out","x":610,"y":140,"wires":[]},{"id":"e5f7fe5d.4ca698","type":"inject","z":"262bf5ee.33d85a","name":"ON","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":310,"y":180,"wires":[["91a37427.551608","efc5858b.00243"]]},{"id":"d787dc50.6ff198","type":"debug","z":"262bf5ee.33d85a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":630,"y":240,"wires":[]},{"id":"4a115a84.026c1c","type":"inject","z":"262bf5ee.33d85a","name":"Initilize to OFF","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":320,"y":80,"wires":[["91a37427.551608","a479e399.307cb"]]},{"id":"5c491259.d4ba0c","type":"inject","z":"262bf5ee.33d85a","name":"OFF","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":310,"y":240,"wires":[["91a37427.551608","d787dc50.6ff198"]]},{"id":"a479e399.307cb","type":"debug","z":"262bf5ee.33d85a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":630,"y":80,"wires":[]}]

It should be said that the effect I want to perform is: after I press the button at the beginning, the tree plum can continue ON, and then follow the first node to do a match, generate a button at the beginning, but sense the fixed When the license plate is used, the tree plum will be OFF.

[{"id":"d2b7852a.b05618","type":"exec","z":"edbc86db.6e9fb8","command":"sudo curl -X POST "https://api.openalpr.com/v2/recognize?secret_key=Your_Secret_Key&recognize_vehicle=1&country=eu&return_image=0&topn=10" -F image=@/home/pi/Pictures/car-photo.jpeg","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"cURL POST","x":731,"y":1317,"wires":[["1ffd9483.014b3b"],,]},{"id":"1ffd9483.014b3b","type":"json","z":"edbc86db.6e9fb8","name":"JSON","pretty":false,"x":882.5,"y":1332.5,"wires":[["9753406b.6d08e","5f3c3d58.fd75e4"]]},{"id":"9753406b.6d08e","type":"function","z":"edbc86db.6e9fb8","name":"Identify Car","func":"var carPlate = "YOUR_CAR_PLATE";\nvar carModel = "YOUR_CAR_MODEL";\n\n//No car or car plate found in photo\nif(msg.payload.results.length === 0) {\n msg.payload=0;\n global.set("garageOpen","0"); \n}\n//If car plate and car model match\nelse if(msg.payload.results[0].plate==carPlate && msg.payload.results[0].vehicle.make_model[0].name==carModel) {\n msg.payload=1;\n global.set("garageOpen","1"); \n}\n//If car plate and car model don't match\nelse {\n msg.payload=0; \n global.set("garageOpen","0"); \n}\n\nreturn msg;\n\n","outputs":1,"noerr":0,"x":292,"y":1521.5,"wires":[["8b530f08.a5dbf"]]},{"id":"3630c78a.035728","type":"camerapi-takephoto","z":"edbc86db.6e9fb8","filemode":"1","filename":"car-photo.jpeg","filedefpath":"0","filepath":"/home/pi/Pictures/","fileformat":"jpeg","resolution":"3","rotation":"0","fliph":"0","flipv":"0","brightness":"50","contrast":"0","sharpness":"0","imageeffect":"none","name":"Take Photo","x":565,"y":1318,"wires":[["d2b7852a.b05618"]]},{"id":"8b530f08.a5dbf","type":"switch","z":"edbc86db.6e9fb8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"0","vt":"str"}],"checkall":"true","outputs":2,"x":432.5,"y":1520,"wires":[["c2bbe2ac.f26ea","8fe08deb.7255e"],["491dea2b.a14d54"]]},{"id":"5f3c3d58.fd75e4","type":"debug","z":"edbc86db.6e9fb8","name":"","active":true,"console":"false","complete":"false","x":1028,"y":1297,"wires":},{"id":"4e5c105d.14285","type":"rpi-gpio in","z":"edbc86db.6e9fb8","name":"GPIO4","pin":"7","intype":"tri","debounce":"25","read":false,"x":111,"y":1359,"wires":[["af21a185.21cd4"]]},{"id":"73147f6a.0129e","type":"switch","z":"edbc86db.6e9fb8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"str"},{"t":"eq","v":"1","vt":"str"}],"checkall":"true","outputs":2,"x":418,"y":1359,"wires":[["3630c78a.035728"],["691d92c5.692d5c"]]},{"id":"af21a185.21cd4","type":"function","z":"edbc86db.6e9fb8","name":"Is Garage Open","func":"var garageOpen = global.get("garageOpen"); \n\nif(garageOpen == "1"){\n msg.payload = 1;\n}\nelse {\n msg.payload = 0;\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":261.5,"y":1359,"wires":[["73147f6a.0129e"]]},{"id":"c2bbe2ac.f26ea","type":"rpi-gpio out","z":"edbc86db.6e9fb8","name":"GPIO17","pin":"11","set":"","level":"0","freq":"","out":"out","x":919.5,"y":1469,"wires":},{"id":"8fe08deb.7255e","type":"delay","z":"edbc86db.6e9fb8","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":610,"y":1528,"wires":[["f2cc1ee4.e9841"]]},{"id":"f2cc1ee4.e9841","type":"function","z":"edbc86db.6e9fb8","name":"Close Garage","func":"msg.payload=0; \nglobal.set("garageOpen","0"); \nreturn msg;\n\n","outputs":1,"noerr":0,"x":770,"y":1528,"wires":[["c2bbe2ac.f26ea"]]},{"id":"691d92c5.692d5c","type":"debug","z":"edbc86db.6e9fb8","name":"","active":true,"console":"false","complete":"false","x":558,"y":1366,"wires":},{"id":"491dea2b.a14d54","type":"debug","z":"edbc86db.6e9fb8","name":"","active":true,"console":"false","complete":"false","x":607,"y":1585,"wires":}]

https://randomnerdtutorials.com/car-plate-recognition-system-with-raspberry-pi-and-node-red/

Please read How to share code or flow json

[{"id":"d2b7852a.b05618","type":"exec","z":"edbc86db.6e9fb8","command":"sudo curl -X POST \"https://api.openalpr.com/v2/recognize?secret_key=Your_Secret_Key&recognize_vehicle=1&country=eu&return_image=0&topn=10\" -F image=@/home/pi/Pictures/car-photo.jpeg","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"cURL POST","x":731,"y":1317,"wires":[["1ffd9483.014b3b"],[],[]]},{"id":"1ffd9483.014b3b","type":"json","z":"edbc86db.6e9fb8","name":"JSON","pretty":false,"x":882.5,"y":1332.5,"wires":[["9753406b.6d08e","5f3c3d58.fd75e4"]]},{"id":"9753406b.6d08e","type":"function","z":"edbc86db.6e9fb8","name":"Identify Car","func":"var carPlate = \"YOUR_CAR_PLATE\";\nvar carModel = \"YOUR_CAR_MODEL\";\n\n//No car or car plate found in photo\nif(msg.payload.results.length === 0) {\n    msg.payload=0;\n    global.set(\"garageOpen\",\"0\");  \n}\n//If car plate and car model match\nelse if(msg.payload.results[0].plate==carPlate && msg.payload.results[0].vehicle.make_model[0].name==carModel) {\n    msg.payload=1;\n    global.set(\"garageOpen\",\"1\");  \n}\n//If car plate and car model don't match\nelse {\n    msg.payload=0;   \n    global.set(\"garageOpen\",\"0\");  \n}\n\nreturn msg;\n\n","outputs":1,"noerr":0,"x":292,"y":1521.5,"wires":[["8b530f08.a5dbf"]]},{"id":"3630c78a.035728","type":"camerapi-takephoto","z":"edbc86db.6e9fb8","filemode":"1","filename":"car-photo.jpeg","filedefpath":"0","filepath":"/home/pi/Pictures/","fileformat":"jpeg","resolution":"3","rotation":"0","fliph":"0","flipv":"0","brightness":"50","contrast":"0","sharpness":"0","imageeffect":"none","name":"Take Photo","x":565,"y":1318,"wires":[["d2b7852a.b05618"]]},{"id":"8b530f08.a5dbf","type":"switch","z":"edbc86db.6e9fb8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"0","vt":"str"}],"checkall":"true","outputs":2,"x":432.5,"y":1520,"wires":[["c2bbe2ac.f26ea","8fe08deb.7255e"],["491dea2b.a14d54"]]},{"id":"5f3c3d58.fd75e4","type":"debug","z":"edbc86db.6e9fb8","name":"","active":true,"console":"false","complete":"false","x":1028,"y":1297,"wires":[]},{"id":"4e5c105d.14285","type":"rpi-gpio in","z":"edbc86db.6e9fb8","name":"GPIO4","pin":"7","intype":"tri","debounce":"25","read":false,"x":111,"y":1359,"wires":[["af21a185.21cd4"]]},{"id":"73147f6a.0129e","type":"switch","z":"edbc86db.6e9fb8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"str"},{"t":"eq","v":"1","vt":"str"}],"checkall":"true","outputs":2,"x":418,"y":1359,"wires":[["3630c78a.035728"],["691d92c5.692d5c"]]},{"id":"af21a185.21cd4","type":"function","z":"edbc86db.6e9fb8","name":"Is Garage Open","func":"var garageOpen = global.get(\"garageOpen\"); \n\nif(garageOpen == \"1\"){\n    msg.payload = 1;\n}\nelse {\n    msg.payload = 0;\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":261.5,"y":1359,"wires":[["73147f6a.0129e"]]},{"id":"c2bbe2ac.f26ea","type":"rpi-gpio out","z":"edbc86db.6e9fb8","name":"GPIO17","pin":"11","set":"","level":"0","freq":"","out":"out","x":919.5,"y":1469,"wires":[]},{"id":"8fe08deb.7255e","type":"delay","z":"edbc86db.6e9fb8","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":610,"y":1528,"wires":[["f2cc1ee4.e9841"]]},{"id":"f2cc1ee4.e9841","type":"function","z":"edbc86db.6e9fb8","name":"Close Garage","func":"msg.payload=0;   \nglobal.set(\"garageOpen\",\"0\"); \nreturn msg;\n\n","outputs":1,"noerr":0,"x":770,"y":1528,"wires":[["c2bbe2ac.f26ea"]]},{"id":"691d92c5.692d5c","type":"debug","z":"edbc86db.6e9fb8","name":"","active":true,"console":"false","complete":"false","x":558,"y":1366,"wires":[]},{"id":"491dea2b.a14d54","type":"debug","z":"edbc86db.6e9fb8","name":"","active":true,"console":"false","complete":"false","x":607,"y":1585,"wires":[]}]

我想要將兩個結合再一起,並且去修改拍照的流程,把全部簡化成當你按下按鈕1後樹梅派會一直輸出vcc,並且按下按鈕2後將會進行拍照,如果拍照的數據結果符合你篩選的要求的時候,樹梅派將會off.
I want to combine the two together, and modify the process of taking pictures, simplifying it all. When you press button 1, Shumei will always output vcc, and after pressing button 2, it will take pictures, if you take pictures. When the data results meet the requirements of your screening, the tree plum will be off.

  1. What two?

I do not see a button in your flow.
2) Is GPIO4 tied to a physical button?
3) what is Shumei?

  1. what is tree plum? I don't understand this

  1. what is Shumei?
  1. what is tree plum? I don't understand this

sorry,is raspberry pi

Is the pi what you refer to as 'Shumei' or 'tree plum'?

%E6%95%B8%E6%9E%9A

Just so we understand each other

  • a series of nodes connected together is called a flow
  • you have a raspberry pi running Node-RED
  • you have two flows that you want to combine
  • a GPIO pin can not be defined as both an input and an output
  • you want to change the flow from the random nerd turtorials site

Currently that flow will start when a sensor connected to GPIO4 is triggered.

You want to add a button to trigger the flow. Do you want to use a physical button or a dashboard button?

For testing, you could just add an inject node next to the GPIO4 node and have both connected to the function node.

If you want a physical pin, you will have to connect it to a GPIO pin that is not already in use. That means you can not use GPIO4 or GPIO17.