Questions tagged [cpp]
The cpp tag has no usage guidance.
17
questions
-1
votes
2answers
79 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 ...
-1
votes
2answers
46 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....
0
votes
1answer
25 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 ...
2
votes
1answer
50 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 ...
0
votes
1answer
40 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(...
1
vote
2answers
58 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 ...
0
votes
1answer
43 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* ...
0
votes
1answer
389 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>
#...
0
votes
1answer
43 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 ...
-1
votes
1answer
50 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 ...
1
vote
1answer
27 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; // ...
1
vote
1answer
560 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 ...
0
votes
2answers
729 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 ...
1
vote
3answers
65 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:
...
1
vote
1answer
2k 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 ...
0
votes
2answers
2k 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 ...
0
votes
1answer
138 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 ...