RUVIDEO
Поделитесь видео 🙏

How to blink led in nodered using for loop | Learn free Raspberry pi online | Raspberry pi basics

If you've used node-red, you might have faced that its quite frustrating to see how difficult it gets to do something as simple as blinking an LED. Since node-red works on dataflow, its hard to create loops like this
Now there's no for loop in node-red (as of now) and this code uses simple javascript function
This simple program will achieve blinking of LED using Switch Connected to Raspberry Pi. The code is created for nodered and am also pasting the JSON which you can import in your node-red to verify the same
code will be pasted inside * symbols. Don't copy them, just copy whats inside it
*******************************************

[{"id":"407ec756.0f0118","type":"function","z":"94e7c1f9.afb24","name":"startBlink","func":"var BLINKDELAY = 1000;\n\nvar light = true;\n\nvar count = 6;\nvar brk = 0;\nvar blinker = setInterval(blink, BLINKDELAY);\n\nglobal.set(\"blinker\", blinker);\n\nfunction blink () \n{\n \n if (light) \n {\n msg.payload = 1;\n light = false;\n count--;\n }\n else {\n msg.payload = 0;\n light = true;\n }\n \n if(count === 0)\n {\n clearInterval(global.get(\"blinker\"));\n msg.payload = 0;\n brk = 1;\n }\n if(brk ===0 )\n {\n node.send(msg);\n }\n else\n {\n msg.payload = 0;\n return msg;\n }\n}\n\nreturn;","outputs":1,"noerr":0,"x":540,"y":280,"wires":[["a096acc8.f113a"]]}]

******************************************

Try this out to see how to blink led using nodered


Hope you'll enjoy the series Tutorials.

To support our work, please go to

https://www.kitflix.com/ and purchase a course

or contact us for any kind of embedded systems, IoT and Python programming consulting at support (at) kitflix.com

Thank you

Check all of our online courses on Udemy as well as on kitflix.com website

1. Crash Course on Embedded C Programming
https://www.udemy.com/course/crash-course-on-embedded-c-programming/?referralCode=5FA1A68B167BA7B80109
And
https://kitflix.com/course/crash-course-on-raspberry-pi-computer/

2. Learn IoT using Micropython and Raspberry Pi PICO W
https://www.udemy.com/course/learn-iot-using-micropython-and-raspberry-pi-pico/?referralCode=BBD8F1D49E1FE1519609
And
https://kitflix.com/course/learn-iot-with-raspberry-pico-w/

3. Start Learning Embedded Systems with AVR Atmega32 Controller
https://www.udemy.com/course/embedded-systems-with-avr-microcontroller/?referralCode=50EA9C563821F5FB44BC
And
https://kitflix.com/course/start-learning-embedded-systems-with-avr-atmega32/

4. Learn bits and bytes of Raspberry Pi & IoT using Node-red
https://www.udemy.com/course/learn-iot-with-node-red/?referralCode=8DA0C5A26BE53D54ADE6
And
https://kitflix.com/course/internet-of-things-using-node-red-and-raspberry-pi/

5. ESP32 and Internet of Things For Absolute Beginners
https://www.udemy.com/course/esp32-and-internet-of-things-for-absolute-beginners/?referralCode=EB89EDBF77AFC134B97C
And
https://kitflix.com/course/esp32-and-internet-of-things-for-absolute-beginner/

6. Beginners Masterclass into Internet of Things
https://www.udemy.com/course/internet-of-things-raspberrypi-azure/?referralCode=0A9FB84D5CD80F6C46E8
And
https://kitflix.com/course/beginners-masterclass-into-internet-of-things/

7. PCB design in just one day with Proteus ISIS and ARES
https://www.udemy.com/course/draft/2704956/?referralCode=4901C4886CC27A8DF980
And
https://kitflix.com/course/pcb-design-in-just-one-day-with-proteus-isis/

8. Advanced Embedded Systems with Arduino
https://www.udemy.com/course/learn-to-build-advanced-embedded-systems-using-arduino/?referralCode=222DC75F0A4989DD9E31
And
https://kitflix.com/course/arduino-masterclass/

9. Python Programming for Non Programmers: Quickly learn python
https://www.udemy.com/course/python-programming-for-absolute-beginners-using-python-3/?referralCode=671E06400E0A30649D04
And
https://kitflix.com/course/python-programming-for-non-programmers/

10. Learn the Art and Science of PCB Design with Eagle
https://www.udemy.com/course/pcb-design-with-eagle/?referralCode=975291A980A1962456D5
And
https://kitflix.com/course/learn-the-art-and-science-of-pcb-design-using-eagle/

11. Embedded Systems with 8051 Micro Controller using Embedded C
https://www.udemy.com/course/embedded-systems-with-8051-micro-controller/?referralCode=AAB05D13521BCFA2BFCC
And
https://kitflix.com/course/embedded-systems-in-8051-micro-controller-using-c/

12. PCB Design for everyone with EasyEDA a free and online tool
https://www.udemy.com/course/pcb-design/?referralCode=FE68781F3CC585DE9905
And
https://kitflix.com/course/pcb-design-for-everyone-with-easyeda-a-free-and-online-tool/

Thank you

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «How to blink led in nodered using for loop | Learn free Raspberry pi online | Raspberry pi basics», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.