Questions tagged [c]

C is a procedural programming language which is widely used in embedded systems. PLEASE NOTE: Arduino is typically programmed in C++, not C.

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

How to get the value of an Arduino/ESP32 variable and use it in a Javascript file?

I have a variable in my ESP32 code. I also have a webserver that displays a HTML page, and in this page I can type a value in a form and send it to that variable via HTTP GET request. The HTML of ...
0
votes
1answer
673 views

'RtcDateTime' does not name a type

I've tested a code that compiles successfully. But after i merged it to another code, here it shown an error says RtcDateTime doesn't name a type. Used library : https://github.com/Makuna/Rtc Some ...
14
votes
5answers
62k views

deprecated conversion from string constant to 'char*'

What does this error means? I can't solve it in any way. warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
0
votes
1answer
22 views

I'm using an Arduino and DS1307 for creating RTC but my code has some issue [closed]

I'm not getting any errors but the values that are supposed be displayed in the RTC_read are not being displayed for some reason.Initially i thought this was maybe due to the code being caught ...
0
votes
1answer
36 views

Serial communication between PC and Arduino using C

I'm trying to send some data to my arduino mega 2560 using serial communication. I'm using the exemple that I found here without success. Every site I read say that I can send data to the arduino ...
1
vote
3answers
210 views

Variable declaration inside main loop

In the past I declared variables inside the main loop which worked just fine. In a new project I did the same: void loop(void) { uint8_t counter; .... if (buttonPress) counter = 0;...
0
votes
0answers
23 views

Controlling UC1638 Graphical LCD screen (C, with Arduino)

I am using Arduino Uno, trying to control LCD screen type UC1638 (240x128 monochrome) I want to fillup the screen in black). Searching up the internet I ended up using this code (written in C): /* ...
0
votes
1answer
31 views

Rounding float number

I want to enable user to change the duration of PWM from 0 to 255, the number should be in minute and increase/decrease with two push buttons. (X) x 255 / 60000 = minute In above example each time ...
1
vote
1answer
49 views

Display not showing output - Arduino Wattmeter

I have been playing with this code for some time now, I am able to show the results in an 16X2 LCD display, but I am not able to do it in an OLED. here is the code #include <SPI.h> #...
0
votes
1answer
63 views

C: No communication to a connected serial port?

I'm trying to connect to an arduino Mega At2560 unit connected via usb serial port in my linux based PC. Using C code, I'm trying to send and receive simple text strings, just I'm able to send and ...
2
votes
1answer
66 views

Arduino wrap or subclass print() to work with multiple Serial

I am writing an Arduino program that uses Bluetooth on Serial1 to print text to a Bluetooth terninal on an Android phone and also normal Serial to print text to the serial monitor on a laptop. I would ...
0
votes
0answers
20 views

How to control motor in trapezoidal manner using arduino

I am Working on a project in that i have to control motor in a Trapezoidal motion profile. on Y-axis is the velocity and X- axis as a time. Velocity increases linearly for a certain time, then ...
1
vote
1answer
47 views

Problems with Serial.read()

void loop() { if (sensor.begin() == true) { Serial.print("Current Conversion Mode: "); Serial.println(sensor.getConversionMode()); Serial.println("Enter your mode of Conversion (number ...
0
votes
2answers
45 views

strtoul behavior between C and Arduino

I have this code C code that compiles OK on my laptop #include <stdlib.h> #include <stdio.h> #include <string.h> unsigned int crc32(const void *m, size_t len) { const unsigned ...
1
vote
1answer
95 views

Running Python on Arduino

I've been using Python for quite long, and I was wondering if it can be used as a programming language for Arduino, rather than C/C++. When I'm using the Arduino IDE, the sketch is compiled into a ...
0
votes
1answer
33 views

"variable does not name a type

Hey guys I'm getting an error that is im pretty sure to do with how i am initializing my variables. It is: exit status 1 'threshold' does not name a type Here's my code: //Global Variables for ...
1
vote
2answers
37 views

Multiple defintion error, Linker error [closed]

Trying to create an elf file for two sets of files in different folders. LIDARBOT.h ----------- #ifndef LIDARBOT_H_ #define LIDARBOT_H_ #include <avr/io.h> #include "drivers/motors.h" #endif ...
0
votes
1answer
28 views

Split serial monitor output to only save part of the output

This is the output i get from the serial monitor from using a HM10 in . How could i go about splitting the data using arduino uno. I only want to save the last 12 digits before the :- (4CAA0DE091B7) ...
1
vote
0answers
43 views

local libraries and include dependencies

I'm using PlatformIO in Atom for Arduino programming. I get dependencies error when build. This is my reproduction sample code: /lib/mylib/mylib.h #ifndef MYLIB_H #define MYLIB_H #include <...
0
votes
1answer
68 views

Stack smashing protect failure ESP32 with Modbus RTU

I'm doing a project using an ESP32 TTGO with LoRa, the Max485 and a WELLPRO ADAM 8082 for Modbus communication. I'm trying to use the ESP32 as a master to and the ADAM as a slave. I'm also using Node-...
0
votes
0answers
15 views

Arduino Sensor Values to Raspberry Pi using NRF24

Im trying to send temperature sensor data through NRF24L01 to Raspberry Pi and read it in Raspberry Pi using python. But the temperature sensor data comes to the Raspberry Pi as letters, which I found ...
0
votes
0answers
19 views

UDP Packet not receiving

I started a project where I wanted to send sensor data from one arduino to another and let this 2nd Arduino send the data to a tablet to visualize sensordata like speed, temperature etc. I wanted to ...
0
votes
1answer
245 views

Read Multiple Sensors Data from a text file located in SD Card in Arduino/ESP32

I am working on a small home project 'glucose meter' via non invasive techniques. I am using four sensors like RGB color sensor, two multi-wavelength photo diodes (A & B) and temperature sensor (K-...
1
vote
1answer
58 views

Working with Wire core library

I'm studying the Wire library code driver utility/twi.h to learn how twi buffering and ISR management work. What I did actually, is that I copied the header/source files from the Arduino path F:\...
0
votes
1answer
60 views

Value assignment on Arduino

I have a thermocouple k. I want this thermocouple to select the first value OF TEMPERATURE that it read and assign it to a variable in an Arduino program. How should I do that?
3
votes
2answers
212 views

Using an external header file

I have a project that is part of a larger repository, and shares header files with non-Arduino C programs. I know that it's possible to use these headers by copying them to the libraries folder, or ...
0
votes
2answers
155 views

How do i send ads1115 data over spi to master arduino

I am trying to send ADS 1115 data which is connected with Arduino mega_1 over I2C and arduino Mega_1 is connected with arduino Mega_0 over SPI. Arduino Mega_1 is act as a slave and send ADS 1115 data ...
0
votes
7answers
979 views

How to parse 20180810T143000Z to time_t

What is the shortest/most elegant way (i.e. use existing lib functions) to parse a string in the form of 20180810T143000Z to a time_t? Note that the literal always represents a UTC timestamp. I ...
0
votes
0answers
34 views

PWM C Code some logical error

I don't know what's wrong with the code I have activated all the bits I need. I want the code to slowly increase the brightness of the bulb and then reset and then the same thing goes on. Please help ...
2
votes
4answers
168 views

How to compare a string

How to compare a string coming from serial monitor with some predefined text stored as a local variable? If I say: int led = 2; String a = " abcds"; void setup(){ Serial.begin(9600); } void loop(...
0
votes
1answer
37 views

Pass structure pointer as an argument to a function in c

I am developing a code in which I need to pass a structure pointer value to a function as a parameter. I am calling function "proto485Compare()" in "RS485TaskSlave()". "rs485Msg" contains my data for ...
1
vote
3answers
20k views

Number of elements in an array char

What kind of function can I use to know how many elements are in an array char? sizeof() gives the number of 'spaces' available so it doesn't work for me.
0
votes
1answer
38 views

Question on pin management using PCA9534PW IO Extender

There is an IO expander PCA9534PW, Arduino UNO. I don’t really understand how I can manage this expander using UNO over I2C. I found an example, but here is the reading mode. What I need: Set the ...
1
vote
1answer
296 views

Cannot obtain reading from meter (Modbus)

I have a system in which I am taking readings from a meter and processing it through an Arduino Nano. My code looks as follows: #include <SoftwareSerial.h> #define SerialControl 7 #define ...
1
vote
1answer
380 views

Length of uint8_t* const array

I've an array of type uint8_t* const with 6 items, defined like this uint8_t* const neighbourSet[] = {PEER1, PEER2, PEER3, PEER4, PEER5, PEER6}; Whereas each element in this array is static uint8_t ...
-2
votes
1answer
48 views

Using two leds with one push button [closed]

How can I make the code of this project where I will press one time a button, to turn on the first led (and turn off second led) and when other one press to turn on second led (and turn off the first ...
8
votes
2answers
3k views

Arduino interruption (on pin change)

I use the interrupt function to fill an array with values received from digitalRead(). void setup() { Serial.begin(115200); attachInterrupt(0, test_func, CHANGE); } void ...
0
votes
4answers
6k views

max7219 chained display showing mirrored text

I'm using a max7219 like this one max7219. When I first tested my circuit, I used an 8x8 display and the code worked just fine. Now, after I modified the code with the one that can be found online at ...
0
votes
2answers
1k views

Arduino UNO + Ethernet Shield + LCD + RFID but RFID doesn't work

I've been working to a project that uses arduino for RFID but when connected to ethernet shield, the RFID seems to not read any card tapped to sensor but the LCD seems to do fine. Here's the code I ...
2
votes
1answer
831 views

Using map for DC motor instead of servo

I am trying to use map command which is used to power servo 180 degrees as the potentiometer moves... in fact what i want to do is just when i adjust my potentiometer to zero; stop the dc motor then ...
0
votes
1answer
51 views

When does a pre/post increment occur? [closed]

Editing here to clarify. The headline asks the question but the example given was not ideal. This was a more general Q than about the example code. Compilers have sequence points, places where you ...
0
votes
1answer
74 views

Random number/sequence output

The program I'm trying to build is: Type in 1st name, hit enter, type in 2nd name and then hit enter again. Register those names from string input to char naming in student struct. Print out the ...
1
vote
3answers
387 views

Why does my LED turn off automatically after about 18 seconds on its own?

I am using the Arduino Due and I am programming it with Atmel Studio 6.2. I have had a HUGE learning curve using this IDE and the Atmel ASF. Nothing is straightforward as it is in the Arduino IDE. ...
1
vote
3answers
88 views

How to assign text stored in a local file to a string at compile time

I'm developing a program that uses the HTML server in the WiFi101 library. My hardware does not have SD card storage so all source html needs to be stored as strings in the sketch at compile time. ...
4
votes
2answers
3k views

“EVERY_N_MILLISECONDS”

One of the FastLED examples that I've seen was using code that looks like this: EVERY_N_MILLISECONDS( 300 ) { transition_step(); } I've copied it and successfully used it in the same context - but ...
0
votes
1answer
53 views

What's going wrong with my EEPROM?

I've been chipping away at a project for a long time now and I've found a serious bug. Basically the user has an 8x8 grid, and each cell in this grid has a number of properties. I want to be able ...
0
votes
1answer
134 views

Read Serial data from an arduino with c code

I am trying to receive data through the serial port from my SBC (a TS-7200), i am working with linux and handle serial communication using C/C++.To send data to the SBC i'am using an arduino uno. So ...
0
votes
1answer
25 views

Can you save data to heap section in Arduino memory?

On normal computers, heap will be cleaned as you close the program, but can I save data to Arduino's heap with malloc function. And will it be cleaned after I power off the Arduino?
0
votes
1answer
135 views

How to handle concurrent HTTP request when using interrupt

I'm trying to make a door sensor with a reed switch. Each time the there is a change, the ESP8266 sends an HTTP request to web service. Unfortunately, the ESP8266 serial monitor dumps a huge stack ...
0
votes
0answers
2k views

IOT-GA6 gsm module Arduino +CME error 58

I've recently bought a IOT-GA6 gsm module . I want to use it to send an mms but doesn't work. The SMS and call work. When I execute the void function (mms) the monitor shows the error message +CME ...