Questions tagged [c++]

C++ is the standard language used to program the Arduino IDE. However, the Arduino IDE does have lots of libraries built in, so functions such as "main" are not called directly in the sketch code. Most Arduino code online is written in this language.

Filter by
Sorted by
Tagged with
0
votes
0answers
7 views

Array to remove a number on arduino [migrated]

guys how can I print and remove this number in array? I am trying to do the array but it is not working: i have a if with this number: if (conteudo.substring(1) == "44 46 00 22") so i would like ...
0
votes
0answers
44 views

ESP8266 computtion error

The related hardware diagnostic could be found here: ESP8266 not working with MPU 6050 over wire library and I2C .But I'm not so sure it's a hard ware issue any more because I got the reading for ...
-2
votes
0answers
50 views

Serial Communication Problem Between - Arduino UNO and ESP8266 (ESP-01)

I have built a Small Project to illuminate a connected LED on the Arduino-Uno via the internet by ESP8266-01 using the adafruit website but the problem is getting a wrong result and not lighting the ...
1
vote
0answers
37 views

How do I write and read .pem certs from SPIFFS?

I'm trying to construct a program for an ESP32 Dev Board that writes my AWS cert files [(https://medium.com/@flynam/securing-your-iot-device-using-ssl-4643110ab901)][1] to SPIFFS so that I can later ...
0
votes
0answers
34 views

How to edit code from Node-Red to Cayenne

I am working on a project to run some (relays or LED's) on an inputs (Pins) Arduino by esp8266-01s . now while searching on internet I found a video divided it two step that talks about the issue ...
0
votes
1answer
36 views

VSCode Platformio Schedule.h: No such file or directory

I suppose this might be more an environment question regarding Platform.io and VSCode, as my code works great in the Arduino IDE, however the lack of syntax highlighting is driving me mad. I've setup ...
0
votes
0answers
12 views

Help with Receiver / Transmitter (nRF24L01+)

Dear fellow Arduino users, My two friends and I are having trouble on an Arduino project we are working on. We are using two Arduino Uno's and trying to have one of them send a signal to another one ...
0
votes
0answers
52 views

Using digital rotary encoders for HID input using the Joystick library

I have been working on a small switch panel for flight sims, but I wanted to use the CYT1100 Digital Rotary encoders to move instruments in-game. I have the code set up to press a certain joystick ...
0
votes
1answer
24 views

How to declare a pointer for arduino neopixels library so I can set it up in the setup function with dynamic variables?

I am using NeoPixel strips, and I want to be able to declare a pointer to them, but not initialize them until the setup function (because they will initialize with certain variables only made ...
0
votes
1answer
44 views

Generate number

I wanna make some sketch to generate number to represent sensor value, with range from high (900) to low (670), that number decrease with range between 1-10 and with some delay of switching number ...
0
votes
1answer
40 views

How to fill a triangle using the LCD5110 Graph library?

Good day! I'm currently trying to create a small 3D engine using C++, an Arduino UNO as well as a Nokia 5110 display with a library. Now I have successfully drawn a cube using triangles, but I want to ...
1
vote
1answer
62 views

Convert C string to C++ string

My program is running on ESP32. I'm retrieving some data from Bluetooth, and the Bluetooth string is a C string. I need to save that data in an RTC_DATA_ATTR String, which is a C++ string. Just doing ...
0
votes
1answer
80 views

i can't work toggle for my small project

i build my small project from a few component as this photo after finish code and project . i work run for Proteus and then the project not run perfectly because my code need toggle for data entered . ...
1
vote
1answer
131 views

First time using Kuman 3.5" TFT screen model SC3A-NEW-UK with Arduino

I bought online this LCD Touchscreen Kuman SC3A-NEW-UK. It uses ILI9486 drivers, but it didn't include any instructions manual, and kumantech.com seems to be devoid of complete technical documentation ...
0
votes
1answer
58 views

Can't use uint16_t in library

I wonder why the following minimal example sketch doesn't compile (unknown type name 'uint16_t'): sketch_does_not_compile.ino: #include "myheader.h" void setup() { char a[]="hello world"; ...
0
votes
0answers
38 views

Mqtt setCallback with arduino mega in custom library

in pubsubclient library in method Set callback, calback is defined as MQTT_CALLBACK_SIGNATURE I found in code #if defined(ESP8266) || defined(ESP32) #include <functional> #define ...
0
votes
1answer
38 views

String to Dynamic Byte array

I'm new in Arduino stuck in String to a dynamic byte array. My String: String Finalval="6D616320747820636E662031352033300D0A"; Dynamic Byte array: byte ft[]={0x6D,0x61,0x63,0x20,0x74,0x78,0x20,...
0
votes
2answers
59 views

EEPROM page rotates while writing to it

The following code intends to read from serial port and write the data byte by byte to a 24LC01B EEPROM. // 24LC01B PINS // Pin 1, A0: float // Pin 2, A1: float // Pin 3, A2: float // Pin 4, VSS: GND ...
0
votes
1answer
39 views

hexadecimal 1 to float 1 - Compare the float 1 with a predefined float 2 - If the float 1 and float 2 are the same - Print hexadecimal 2

I want to input a hexadecimal data from cool terminal say like (05 00 02 03 00 04 00 E5) And convert the data to a float value say 45.3. Now that I have to preassign a float value say 45.3 in my ...
-1
votes
2answers
68 views

data classification with arduino

I want to classify my data from 3 sensors with arduino so that every time i enter the specific date or hour, or also it can be a period of time like 10 days ago, it shows me the exact data. In other ...
0
votes
2answers
58 views

I want to send the last 10 minute data via bluetooth

This was for photocell data logging for 30 sec intervals, now I want to write a code which commands from the cellphone and sends back the last 10 minute data. at first I thought if I make an array of ...
0
votes
2answers
74 views

How to toggle LED and motor on button press?

we want to have a LED turn on with the press of a button, and become brigther and brighter as times go by (whithin a defined time frame), and when it reaches maximum brightness to turn off for a ...
0
votes
2answers
199 views

How Can I convert my arduino code to C/C++ embedded code [closed]

For example I have an code for arduino but I want to change it to embedded C to create more professional project with different hardware. is there any tutorial? I know the logic and the most of the ...
0
votes
2answers
82 views

Two Reed switch in two way directions

Hi im a student having problem in coding I want to set two reed switch in two direction. Example : 1. Reed switch 1 detect then reed switch 2 detect - led turns to yellow 2.If reed switch 2 detect ...
0
votes
1answer
59 views

Undefined reference to Class::function()

I have three files: main.cpp RotaryEncoder.h RotaryEncoder.cpp Note that the RotaryEncoder class acts as a wrapper to the Encoder library. I am getting the following build report and I haven't been ...
0
votes
1answer
132 views

ESP8266 stops working when I use 2x static const char(PROGMEM)

*Sdk version: 2.2.2-dev(5ab15d1) *Core Version: 2_6_1 This is the error returned: Exception 3: LoadStoreError: Processor internal physical address or data error during load or store PC: 0x4000bf64 ...
1
vote
0answers
78 views

How to parse data most efficiently coming through mqtt with ESP8266

I am writing a program that is currently set up like so: Python script running on my computer. Raspberry pi is the broker for the mqtt data transmission An ESP8266 is programmed to listen to/...
0
votes
1answer
85 views

Alternative IDE for compiling and running arduino code?

I am not super experienced with c++ and I know that the syntax for C++ and the code written/compiled by the arduino IDE are slightly different. I would like to be able to write code, compile it the ...
1
vote
1answer
105 views

Publish chipid to mqtt using ESP32-CAM

I have been trying to push the data of temp, humidity, and pressure from a sensor to MQTT using ESP 32Cam, and was able to do using the following code: pressure = bme.readPressure(); //Convert the ...
0
votes
1answer
60 views

C++ State Machine / Wpmf-convesion

I'm quite a newbie using C ++. I am trying to implement in C ++, the state machine described in this link for C language: https://barrgroup.com/Embedded-Systems/How-To/Coding-State-Machines. I have ...
0
votes
1answer
53 views

Variable sets to 32767 - MATLAB Arduino

I am running out of ideas of what may be causing this problem, and I would appreciate some help identifying anything I am overlooking. Quick Problem Summary A variable gets set to 32767 quite often ...
0
votes
1answer
77 views

How to use existing (non-arduino-specific) library with subfolders in Arduino IDE?

I have a generic c++ library that i'd like to use in an arduino project without making changes to the library code. The library contains subfolders and files in the library include other files of the ...
0
votes
3answers
448 views

Incompatible types in assignment of 'uint8_t {aka unsigned char}' to 'uint8_t [1] {aka unsigned char [1]}'

I'm trying to send custom data. But it doesn't seem to work. I can't find a way to parse my string to a unit8_t. I tried to follow other people's solutions but they don't seem to work for me. // ...
0
votes
0answers
50 views

Byte not written to the memory

In the following code I'm computing crc and setting it as last (11th) byte in the array. The problem is it's sent on I2C just when I print it on the serial terminal. static constexpr uint8_t ...
0
votes
1answer
20 views

What are the sizes of each primitive datatype on a Metro M4 Express SAMD51?

What are the data sizes of all the primitive datatypes on a Metro M4 Express SAMD51 C++ implementation? In some C++ implementations, int has 16 bits and in other implementations it has 32 bits. Is
1
vote
1answer
29 views

Ramping up and down arduino motor due to ultrasonic sensor input

Im working on an arduino robot that needs to follower a leader robot infront of it. The leader robot can accelerate, decelerate , and stop and my robot needs to be able to follow the leader without ...
0
votes
2answers
134 views

Yet another basic and silly question about C++ strings

I made a sketch like this: void setup() { // put your setup code here, to run once: Serial.begin(9600); char str1[64] = "test with spaces"; char str2[32] = "test with spaces"; Serial....
0
votes
1answer
62 views

expected primary-expression before ',' token

EDIT: have solved the problem. It was missing the quotation marks around each letter. Thanks for your help, st2000! I am very new to Arduino and C++ (coding in general!). Have copied an example code, ...
0
votes
1answer
43 views

Using a scrolling text in OLED Adafruit_SSD1305

I have been in internet for the past week looking for a way of programming a scrolling text (either left or right) using Adafruit_SSD1305 but I only find scrolling commands for Adafruit_SSD1306. Has ...
1
vote
1answer
151 views

How to read voltage using ADS1115

I'm very new to this. I found this tutorial. But it don't explain how to read voltages higher than Arduino 5V. I have connected a 100K ohm resistor to positive and 10K ohm to negative of my 24V power ...
0
votes
1answer
253 views

Is std::array (from the C++ STL) safe to use on arduino? Does it use dynamic memory allocation?

I'd like to use std::array on a project that will need to be very stable, and have all memory pre-allocated to avoid heap fragmentation. I am reading in characters from the serial port, following a ...
1
vote
2answers
191 views

Where do class files go in Sloeber Eclipse project?

I'm attempting to create a new Arduino project using Sloeber (Eclipse). Assume it's a newly-created project whose main entry file is ".\ArduinoMainClass.ino" Now... assume I want to create a half ...
0
votes
0answers
387 views

CLion + Arduino — Cannot find any CMake profile

I'm trying to get CLion 2019.2 working with Vladimir Schneider's Arduino Support plugin (v1.4.4, from the Jetbrains Plugin repository) I installed MinGW from https://sourceforge.net/projects/mingw/ ...
2
votes
2answers
244 views

Use std::list in Arduino programming

When trying to compile #include <list> std::list<byte> l = { 7, 5, 16, 8 }; in the Arduino IDE (with ATtinyCore for ATtiny4313), I get this message: error: list: No such file or ...
0
votes
2answers
175 views

Weird sound when modulating the pulse width on Arduino

I'm trying to generate a pulse width modulated sound using Arduino Nano. But it generates the weird sound unlike my expectation. Here's my code: class Phasor { public: Phasor(const float ...
0
votes
0answers
48 views

I cant seem to form a code to read both DHT11 and pulse sensor

I combined both the heart pulse sensor code and the DHT11 code. I can get a decent reading from the pulse sensor however an error is given from the DHT11 sensor. I am able to get them to function ...
1
vote
1answer
67 views

74HC595 not working properly

I've used the following code to light 8 yellow leds sequentially but it only runs as it's supposed to be on Proteus. However in my breadboard the 8 leds keeps blinking all together, the resistors used ...
0
votes
0answers
226 views

No known conversion for argument 1 from 'Object*' to 'int*'

I'm terrible with pointers and need help passing an object to a library I'm writing. I'm getting the error no known conversion for argument 1 from 'LCDMenuItem*' to 'int*' when I try to compile. How ...
-1
votes
2answers
50 views

Do comments occupy space in compiled C++ sketch? Arduino / NodeMCU

I tend to leave old code around as comments until I am sure that my current version is stable. Just the way I like working. I am concerned that I may be unnecessarily bloating up my sketches. Do ...
0
votes
1answer
124 views

Can't Compile .ino using ArduinoJson Library

I am using an ESP32 NodeMCU for which I wrote working software before. This also occurs when I just try to compile without uploading, so no hardware problem. I am using the newest version of ...

1 2 3 4 5 17