Questions tagged [c++]

C++ is a compiled general-purpose programming language that adds object-oriented features and other enhancements to the C language, which it is largely a superset of. It is popular for both embedded and PC software development.

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

Remapping PD1 to be a GPIO STM32Duino

I would like to remap the PD1 PD1-OSC_OUT pin on the STM32F103C8 running arduino framework. Originally on bluepill these pins ...
0 votes
1 answer
1k views

How to fix the error "Response code 0" to get "Response code 202" to bulk update a thingspeak channel?

I am using this example: https://www.mathworks.com/help/thingspeak/continuously-collect-data-and-bulk-update-a-thingspeak-channel-using-an-arduino-mkr1000-board-or-an-esp8266-board.html According to ...
0 votes
1 answer
43 views

Programmer is not responding error

I currently am running into problems with my new Arduino board. The complete details are here with log info and other troubleshooting steps https://forum.arduino.cc/t/programmer-is-not-responding-...
0 votes
1 answer
2k views

MCP23017 with NODEMCU v3 (lolin) I2C doesn't work

I want to use NodeMCU v3 with a MCP23017 that has a MAX6675 at the end. Everything is in the circuit; please see the image. The MAX6675 (U3) doesn't want to work with the MCP23017. First MAX6675 (U4) ...
0 votes
1 answer
69 views

Why are GPIO Expander Registers Being Rewritten?

I'm using an LPC1768 microcontroller (mbed) and 4 GPIO expanders (MCP23017). I am trying to write to the expanders to enable the pull up resistors and some other functions, but am getting strange ...
2 votes
2 answers
256 views

Load bootloader on ESP32

I'm trying to load the bootloader to my esp32 or that's what I think I need, because when I connect it with USB to TTL, and I connect TX with RX, Rx with TX and GND with GND and I reset the micro by ...
0 votes
1 answer
371 views

Two stepper motors at different speeds using potentiometer and Arduino

I am trying to control two different motors using an Arduino and some drivers. The problem I have is that using millis() (I need to use a timer without ...
0 votes
1 answer
90 views

Fake content in serialized array

I have network structures and a container structure (nvs) that holds the number of networks and a pointer chain for each network. I would like to serialize this container and then store it in Non ...
0 votes
0 answers
86 views

How do I control the brightness of a TFT LCD through SPI (No Backlight Pin)

I recently purchased a TFT LCD (GMT020-02 VER1.1) The screen uses the ST7789V LED Driver and does not include a backlight control pin, So Originally I though that it was impossible to control it (i.e ...
184 votes
16 answers
103k views

Is C++ suitable for embedded systems?

A common question, here and elsewhere. Is C++ suitable for embedded systems? Microcontrollers? RTOSes? Toasters? Embedded PCs? Is OOP useful on microcontrollers? Does C++ remove the programmer too ...
0 votes
0 answers
66 views

Losing external EEPROM data after power Cycles on ESP32

Sending "1" starts the write operation into the eeprom every 1 second to the next available address, and sending "2" starts reading the written values into the eeprom. When there's ...
0 votes
2 answers
660 views

Raspberry Pico and DHT11 not working C/C++

This is my wiring here: + is connected to 3v3, - to GND and OUT to pin28. I'm using this ...
0 votes
0 answers
1k views

Raspberry Pi Pico: Hardware UART Tx not working

I recently got a Raspberry Pi Pico as an evaluation board for the RP2040. When I tried to use hardware UART, I found that it would not send data. To find out what was going on, I used an LED on the Tx ...
15 votes
3 answers
1k views

Avr-gcc using repeated addition instead of MULU instructions

I recently compiled some C++ code for the ATmega1284P in Atmel Studio and was analyzing the timings of some routines using my scope. To my surprise, a loop I thought I had optimized was taking longer ...
5 votes
1 answer
118 views

Is LTC2485 Arduino library missing information?

I'm using LTC2485 and got confused by the provided software code vs. the datasheet. As described in LTC2485 I2C Data Format the LTC2485 ADC is 24 bits + sign ADC so like 25 bits. In the given software ...
1 vote
1 answer
162 views

Input capture and timers

Microcontroller: STM32F401RE Doing input capture on TIM1's channel 1,2,3,4. ARR register value is 65536. The clock is 8Mhz. The 4 input capture channels are connected to 4 microphones. As soon as a ...
1 vote
2 answers
269 views

Can you deliberately damage RAM using pointers?

Can one deliberately cause physical damage to RAM using C++ and its implementation of pointers? What about segmentation faults? Can they cause any damage? Example: trying to access a non-existent ...
1 vote
2 answers
2k views

How to implement 32-bit adder logic using two 16-bit adders?

I've been trying to implement a 32-bit adder by instantiating two 16-bit adders. The code is compiling but failing some test cases. I don't know what is going wrong in this. verilog code ...
0 votes
1 answer
48 views

Can I write and read a parallel EEPROM content with Analog Discovery 2?

I am wondering if I can read or write the contents of a parallel EEPROM (e.g., 28C64) using Analog Discovery 2. Is C/C++ necessary for this purpose, or is Java sufficient (since AD2 allows scripting ...
0 votes
2 answers
146 views

Planning a University Course: Advantages of modern MCU platforms [closed]

I want to get sincere advice regarding the use of microcontrollers in educational institutes. I am an Engineer at a University in India. We have been using PIC microcontrollers (PIC16 and PIC18) for ...
0 votes
0 answers
190 views

Printf retarget on STM32 with CubeMX

I'm using STM32F7xx for my project where I use VS Code text editor in combination with CMake project build. I also use CubeMX for code generation. For a record I have already examined all the answers ...
0 votes
0 answers
133 views

Array not initialized properly in STM32Cube IDE

I have a function conv 2D , that takes in 4D and 1D vectors as inputs (inputs, weights,outputs and biases) along with size parameters which are int (filter height, width etc). The function directly ...
0 votes
2 answers
510 views

Error with arduinoFFT library

I'm trying to use the arduinoFFT library (https://github.com/kosme/arduinoFFT) with my ESP32. I made a basic program just to see if the FFT is done correctly. The problem is that I can't compile the ...
0 votes
0 answers
109 views

Pixel offset in image from FLIR Lepton 3.5 VoSPI

I´m working on my driver for a FLIR Lepton 3.5 thermal imaging sensor attached to an ESP32-S3I want to display the image on an LCD, but the image contains line offsets. I use the following settings ...
0 votes
2 answers
123 views

Can I capture keypad values with an analog pin?

I am building a calculator with an Arduino Uno. The thing is I ran out of pins. The switch membrane has 4 rows and 4 columns resulting in 8 pins it doesn't fit. That is why I plan to do a shift ...
12 votes
3 answers
2k views

Microcontroller Sleep Race Condition

Given a microcontroller that is running the following code: ...
2 votes
1 answer
192 views

GP2Y0A21YK0F Sharp IR sensor not counting below a certain distance threshold

I'm building a self-navigating robot that uses IR sensor (GP2Y0A21YK0F model) with Arduino to navigate through a terrain, however during testing phase when I put my hand closer than 7cm it bugs and ...
1 vote
1 answer
145 views

avr-gcc optimization deleting register writes on ATTiny402

I'm using avr-gcc (12.1.0, built with this script: https://github.com/ZakKemble/avr-gcc-build) to compile for the ATtiny402 and encountering problems with code optimization. Specifically, the compiler ...
1 vote
1 answer
95 views

arm-none-eabi-g++ can't find cc1plus unless run from gdb?

I am trying to port some simple c++ code to armv7e-m. I have experience compiling c++ for arm but this is my first time setting up the toolchain from scratch. Initially, I was having the following ...
2 votes
2 answers
144 views

SPI data format for daisy-chained AD5207 digital potentiometer control

I am working on a project using two daisy-chained AD5207 digital potentiometer ICs controlled by the SPI interface of an STM32 micro. I'm following the directions given on P.9 of the AD5207 datasheet, ...
0 votes
1 answer
301 views

Saving a memory address in a variable

If I initialize a variable (in the SRAM), can it happen that its location/position in memory changes each time I simulate or add other variables to the program? Or will it always remain in that ...
0 votes
3 answers
390 views

Phased Array Antenna simulation coding

I have already coded the phased array antenna radiation pattern for my university project with Matlab. I will probably do this again for my master's thesis (phased array patch antenna). Is there any ...
8 votes
1 answer
683 views

Program never goes into interrupt

I used to work with C but I am trying to learn using C++ for embedded programming. I want to do a basic GPIO interrupt example to understand the structure of a class and its usage. My microcontroller ...
4 votes
2 answers
827 views

Embedded C++ and multiple copies of same structure

In embedded programming it is my understanding that we do not use dynamic memory allocation since we are working with a fixed-resources system and the code needs to be compiled for worst case memory ...
2 votes
2 answers
623 views

Why does making this change to my DHT11 code cause it not to work?

Note: This might not be a programming question. If it turns out that it is, I will close it. I am using an ESP8266 to build some air quality web servers. One of the sensors I am using is the DHT11 (...
1 vote
1 answer
434 views

How to turn on and off a LED when an ESP32 board reaches a specific internal temperature threshold?

I'm a beginner and I'm working on a project to turn on and off an LED using a phone app. I'm using DOIT ESP32 Devkit V1 which I control via Wifi using Blynk app, jumpers, and an LED. At first I wrote ...
0 votes
1 answer
35 views

How to code process_state variable which reruns each time process commences?

I am making a bottle filling machine. I am using the YF-S201 water flow sensor to do the same and a 600ltr/min pump. While according to the sensor datasheet I should get the 750ml at 369 pulses, but ...
-2 votes
2 answers
111 views

Drivers in C++ produces bigger assembly [closed]

I'm trying to figure out whether C++ is a suitable language for use in device drivers, like peripherals on Cortex-M3/M4. I started writing some drivers for GPIO and I noticed that it produces bigger ...
1 vote
4 answers
280 views

How to make water flow sensor work to measure flowed water and not flow rate

I am using the YF-S201 water flow sensor. I am using this to fill up bottles. I need to know how to alter the below code in a way that instead of measuring flow rate it measures water passed through. <...
7 votes
2 answers
2k views

What does a function mean that doesn't have "void", "int", etc in front of it mean?

I am following a programming build in Arduino and I came across this code here: ...
2 votes
0 answers
304 views

Reading 2 digit 7 segments with ESP32 using TM1650 maybe?

I have been trying to contact a forum member that has done a modification to his pool equipment in order to control it remotely instead of having to go to the box every time and check on the codes. ...
2 votes
1 answer
1k views

Using C++ objects within FreeRTOS Tasks

I'd like to make use of object-oriented practises inside a FreeRTOS application. Is this as simple renaming files with task functions as .CPP, and instantiating objects, etc. inside the function, ...
1 vote
0 answers
1k views

Set brightness of flash lamp/LED with an ESP32

This sketch is to turn on and turn off an LED flash (torch) on board ESP32S camera periodically ...
-1 votes
3 answers
3k views

I have an error saying: expected unqualified-id before 'if'

...
0 votes
1 answer
53 views

vivado HLS or SDsoc for use openCV

I want to do an image processing by openCV on FPGA . But I do not know if I should use the SDsoc method or the vivadoHLS method. The size of the images I am going to process is large and I want to ...
0 votes
3 answers
361 views

Saltwater Measurement via Arduino

This is a strange question, but I'm trying to learn specific uses for all of the Arduino functionalities. If I were to program the Arduino to spit back the result of analog input into serial as seen ...
1 vote
0 answers
72 views

ESP8266 D1 mini pro/ Arduino IOT, no function is getting called

I coded this: ...
-5 votes
1 answer
682 views

Polling a button and delaying/switching based on the input. Millis? Delay and loop counter? [closed]

So this is the setup: I previously asked a question about this assignment. THIS IS A NEW QUESTION. THIS IS NEW CODE. ONLY THE IMAGES ARE THE SAME. I originally approached this using an interrupt on ...
-1 votes
2 answers
413 views

Why is my interrupt so slow/inconsistent? Arduino external interrupt as pedestrian crossing button

So this is the setup; It's a traffic light system with 2 road lights and a pedestrian crossing. The normal sequence is alternating between main road green and secondary road green. It reads these ...
3 votes
2 answers
503 views

Detecting the push button outside the loop function in Arduino

I'm new to Arduinos. I made a simple digital clock with an Arduino, a 2 x 16 LCD, and two push buttons to control the digits in the clock, one on the digital pin 10 to increase the digits of the ...

1
2 3 4 5