Questions tagged [cpp]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
403 views

How to get the scan duration below 1sec with Arduino BLE?

I want to scan continuously for other Bluetooth devices with my ESP32 using BLE. The scan method only accepts integers larger than 0, such as scan->start(1, false). However I want the results to be ...
Philipp's user avatar
  • 109
5 votes
1 answer
668 views

Delay() and millis() functions don't work in cpp external files

I'm currently facing an issue using delay() and millis() functions in an external cpp file. The issue is that when I used delay() in my main program (meaning .ino file) it works well but when I call ...
Cyril_Ram's user avatar
1 vote
2 answers
372 views

Error compiling ESP32 Wrover Module in Linux Virtual Machine

SO i have been getting this error window when i compile a simple code to run different LED lights on the ESP32-S2-SOLA (Wrovere) module Code: int LED_BUILTIN = 2; void setup() { pinMode (...
AsmAsmAsm's user avatar
0 votes
1 answer
56 views

CPP Function param use function with multi params [closed]

I want to specify a function with parameters for a function parameter, but it doesn't come together. //////////////////////////////////////////////////////////////////////// // Example funch... void ...
CloverField's user avatar
1 vote
4 answers
166 views

Is there anything wrong with this code

Hi I'm pretty new to cpp. Could someone review my code and explain any pitfalls or problems? Below is the code and an example to read from a flow meter with a hall sensor. Thanks in advance. Greg /...
Yardie's user avatar
  • 23
-1 votes
2 answers
622 views

How to convert an int to const int in Arduino?

For a specific project, I need to convert an int to a const int variable type. int i = 10; boolean ShiftRegister[i] //Throws error const int i = 10; boolean ShiftRegister[i]// Works Fine as i am ...
Subha Jeet Sikdar's user avatar
-1 votes
2 answers
185 views

How can I execute a string in my Arduino Uno board?

I was making a project with Arduino Uno , It's working is like this it connects to a key pad and a 7segment display ,and when you press a run button connected to Arduino it should run the code written....
Aryan Bhosale's user avatar
0 votes
1 answer
133 views

Can't change pins in AM2320 code, types mismatch

I took a simple A2320 temperature sensor and connected it not to A4/A5, but to A1/A0 pins. SDA => A1, SCL => A0. (In C code they are number 15 and 14). But I can't call the library to take ...
user avatar
2 votes
1 answer
247 views

How to use PWM with DRV8870?

I'm using Arduino nano and I'm struggling working with the DRV8870 IC on PWM mode. When I use analogWrite(_pin, duty_cycle); the motor makes weird noises. I thought it's because of the PWM frequency ...
KD Technology's user avatar
0 votes
1 answer
392 views

String array length in function

I know this question has been asked a thousand times, but I can't find a solution for my case. I what to get the length of a string array in a given function. This is for an arduino board. #define LEN(...
will.mendil's user avatar
1 vote
2 answers
364 views

Nothing received from function returning array of strings

My read function returns an array of strings. i.e ssid and password String* configuration::read() { String rw_ssid = ""; String rw_pswd = ""; const int keys = 2; String read_ssid_pswd ...
Ciasto piekarz's user avatar
0 votes
1 answer
57 views

what is causing my esp8266 setup function to reinitialise?

Here is code I have written: #include <stdio.h> #include <ESP8266WebServer.h> #define MAX_WIFI_INIT_RETRY 50 #define WIFI_RETRY_DELAY 500 const char* wifi_ssid = "ssid"; const char* ...
Ciasto piekarz's user avatar
0 votes
1 answer
2k views

Getting error invalid conversion from 'const char*' to 'const uint8_t*

I have written this sketch, and I am trying to populate the array of wifi hotspots to set the value in html select using javascript dynamically. #include <Arduino.h> #include <Hash.h> #...
Ciasto piekarz's user avatar
0 votes
1 answer
89 views

trying to make wemos d1 code modular causes collect2: error: ld returned 1 exit status exit status 1

#include "connection.h" void setup() { Serial.begin(115200); Funcs::Connect conn; conn.connectWifi(); } void loop() { } then connection.h file: // connection.h namespace Funcs { class ...
Ciasto piekarz's user avatar
-1 votes
1 answer
92 views

How to respond dynamically by using File Containing Templates?

We are developing a Web Console and REST API for the NodeMCU V3 ESP8266, using ESPAsyncWebServer. We are facing some difficulties to serve dynamic pages using File Containing Templates! We're unable ...
Śhāhēēd's user avatar
1 vote
1 answer
64 views

Update class attribute with attachInterrupt

I want to refactor this code /* YF‐ S201 Water Flow Sensor Water Flow Sensor output processed to read in litres/hour Adaptation Courtesy: www.hobbytronics.co.uk */ volatile int flow_frequency; // ...
Valanthor's user avatar
1 vote
1 answer
784 views

Using SoftwareSerial.h in .cpp file

I am trying to modularize the different components in my arduino build by using objects, but am having trouble with the one controlling a wireless transceiver, which uses SoftwareSerial.h I believe I ...
Snappawapa's user avatar
0 votes
2 answers
941 views

WifiClient and aREST on esp32 - loop until new instructions recieved?

I've created a simple sketch for an esp32 that hosts a REST API that can be accessed via HTTP. Based on the instructions received from the client, the esp32 controls some neopixels with some various ...
shadowkrazee's user avatar
1 vote
3 answers
77 views

Guideline in library creation

According to this example, creation of an Arduino library is quite understandable. But a few things I would like ask (mostly regarding to what to be defined where) when a library is not that simple: ...
guyd's user avatar
  • 965
1 vote
1 answer
5k views

getting error 'Serial' was not declared in this scope

I am adding Dust Sensor to my particle photon project at home, I got this GitHub project that I want to test before implementing a final code. I am not an expert in cpp, I wanted to modularise the ...
Ciasto piekarz's user avatar
0 votes
2 answers
3k views

How to store an RFID tag number in a string

I want to send RFID tag number to PHP page. So far I have sent a fixed string to php and it worked, now I am not getting data in string when i scan rfid tag. I want to store every RFID tag number in a ...
Salman Mahmood's user avatar
0 votes
1 answer
147 views

Changing outputs infinitely for no reason

Im a student and working on a arduino project for IoT competition and me and my team have built a house and I made this code below. For some reason when I upload it to my Arduino MKR1000 it constantly ...
mike6715b's user avatar
  • 103