Post topics, source code that relate to the Arduino Platform

User avatar
By inzmam
#75958 // Control ESP8266 anywhere

// Import required libraries
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include <aREST.h>
#include <Wire.h>
#include "SSD1306.h"

SSD1306 display(0x3C, 1, 3);

// Clients
WiFiClient espClient;
PubSubClient client(espClient);

// Create aREST instance
aREST rest = aREST(client);

// Unique ID to identify the device for
char* device_id = "54691";

// WiFi parameters
const char* ssid = "PTCL";
const char* password = "palwan786";

// Functions
void callback(char* topic, byte* payload, unsigned int length);
static const char xyz[] PROGMEM = ".";
void setup(void)
// Start Serial

// Set callback

// Give name and ID to device
rest.set_name("Control Electrical Appliances");

// Connect to WiFi
WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) {
display.drawString(0, 0, ".");
Serial.println("WiFi connected");
display.drawString(12, 0, "WiFi is connected");

// Set output topic
char* out_topic = rest.get_topic();


void loop() {

// Connect to the cloud


// Handles message arrived on subscribed topic(s)
void callback(char* topic, byte* payload, unsigned int length) {

rest.handle_callback(client, topic, payload, length);


i have this code . but it is giving error

Arduino: 1.8.5 (Windows Store (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, 4M (1M SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

In file included from C:\Users\salman\Documents\Arduino\libraries\esp8266-oled-ssd1306-master/OLEDDisplay.h:32:0,

from C:\Users\salman\Documents\Arduino\libraries\esp8266-oled-ssd1306-master/SSD1306Wire.h:31,

from C:\Users\salman\Documents\Arduino\libraries\esp8266-oled-ssd1306-master/SSD1306.h:30,

from C:\Users\salman\Documents\Arduino\oled_and_arest\oled_and_arest.ino:11:

C:\Users\salman\Documents\Arduino\libraries\esp8266-oled-ssd1306-master/OLEDDisplayFonts.h:4:12: error: ArialMT_Plain_10 causes a section type conflict with __c

const char ArialMT_Plain_10[] PROGMEM = {


In file included from C:\Users\salman\Documents\ArduinoData\packages\esp8266\hardware\esp8266\2.4.1\cores\esp8266/Arduino.h:258:0,

from sketch\oled_and_arest.ino.cpp:1:

C:\Users\salman\Documents\ArduinoData\packages\esp8266\hardware\esp8266\2.4.1\cores\esp8266/pgmspace.h:16:51: note: '__c' was declared here

#define PSTR(s) (__extension__({static const char __c[] PROGMEM = (s); &__c[0];}))


C:\Users\salman\Documents\ArduinoData\packages\esp8266\hardware\esp8266\2.4.1\cores\esp8266/WString.h:38:76: note: in definition of macro 'FPSTR'

#define FPSTR(pstr_pointer) (reinterpret_cast<const __FlashStringHelper *>(pstr_pointer))


C:\Users\salman\Documents\ArduinoData\packages\esp8266\hardware\esp8266\2.4.1\cores\esp8266/WString.h:39:34: note: in expansion of macro 'PSTR'

#define F(string_literal) (FPSTR(PSTR(string_literal)))


C:\Users\salman\Documents\Arduino\libraries\aREST-master/aREST.h:1849:16: note: in expansion of macro 'F'

addToBufferF(F(", "));


exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
User avatar
By PerlUser12
rudy wrote:
PerlUser12 wrote:I have my code on my other post here is the link to it viewtopic.php?f=33&t=17608

Could you give me the link to the post that explains what your code is supposed to do?

My code is supposed to create a web server which then send High or Low commands to the GPIO pins on my arduino board which then activate a 12 volt valve. But it can only send the commands once after the button on the web server is pushed. I want the commands to repeatedly send in a loop, I have experimented with a while loop which somewhat worked but I was not able to break the loop from the web server which is a requirement for my project.
User avatar
By rudy
it can only send the commands once after the button on the web server is pushed. I want the commands to repeatedly send in a loop

OK, now I understand what you are trying to do. My initial thought was a bit of Javascript code included in the html. There probably are other methods available with HTML5 but I would have to look.