Skip to content

STEM education with Arduino​ Application version: LED control using MQTT and Node-RED Part 1

Original Title: ArduinoでSTEM教育​ 応用編:MQTTとNode-REDを用いたLED制御 その1

gemma

Published January 30, 2023

Original author: STEMSHIPOriginal source (new tab)

STEM education with Arduino​ Application version: LED control using MQTT and Node-RED Part 1

Components

Hardware components

Project description

Program for ethernet shield First, let's look at the sketch when using Arduino and Ethernet Shield. I will also show sketches of ESP8266 and ESP32 later. These are slightly different programs. #define LEDPIN 3 #define ANALOGPIN 0 #define MQTT_BROKER "192.168.1.137" #include "SPI.h" #include "Ethernet.h" #include "PubSubClient.h" //(1) byte MAC[] = {0x00, 0x08, 0xDC, 0x12, 0x34, 0x56}; EthernetClient ethClient; PubSubClient mqttClient(ethClient); //(2) long Timer = 0; char Buffer[50]; void setup() { pinMode(LEDPIN, OUTPUT); Serial.begin(115200); delay(100); Serial.println("My IP-Adresse: ")…

Keep reading with a free account

Guests can read 15 projects per visit. Log in or create a free account to read the full description, open the documents and join the comments.