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
1
vote
0answers
14 views

I can get arduino code/board to show voltage using analog input but not python/board

I am trying to simply read a voltage from a battery. I am able to work out how to do this using arduino code on an arduino board. (UNO) When I try to do the same thing on a board using python the ...
0
votes
1answer
31 views

Should I use C or C++ for a pure code implementation of Arduino?

I have an arduino board (SAMD21 microcontroller) which supports either Arduino or CircuitPython programming. I'd like to program in pure C/C++ instead of Arduino, which seems to be possible without ...
2
votes
1answer
806 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
1answer
49 views

On-device logging of all Serial.print calls? [closed]

My Arduino program produces debug/error output using methods like Serial.printf. I can see all this output when it's connected to the computer, but I want to also log all this same output to my board'...
3
votes
1answer
60 views

Why am I only receiving the first address byte? (I2C Protocol)

Expecting the slave to ACKnowledge and return data, but it does not. This is my protocol. This is my Datasheet. Also FYI I'm on an Arduino Fio but I am not inheriting the Arduino library. #include &...
0
votes
1answer
846 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> #...
1
vote
1answer
220 views

How I can send data information without work WiFi to LCD?

Hi everyone I am beginning learn coding and the second language English. I have small project I use Arduino uno , esp8266 , dht11 , lcd I2C and use blynk app in my project I have the code and work ...
0
votes
1answer
175 views

Code conversion

Following is the zabbix documentation with the query header format. Document Zabbix I have difficulty implementing this header in C ++ (Arduino), I saw an implementation of what I need in this forum ...
1
vote
2answers
518 views

help explain pulseIn function with arduino and Ultrasonic sensor

dears Engineers.. i got stuck with this issue couldn't understand.. please help with explanations. first i was upset of my ultrasonic sensor reading deviations, that is i examine my sensor indoor and ...
1
vote
2answers
618 views

serial is print twice?

I have a problem , when send 1 or 0 by Bluetooth module the serial monitor print two time (RECEIVED SMS) . what's the wrong ? This is my code : char BluetoothData = 0 ; void setup() { // ...
1
vote
1answer
547 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-...
0
votes
0answers
50 views

Issues porting capacitive touch code from Arduino to avr

I'm trying to port GreatScott's capacitive touch code to avr. From my understanding the timer is constantly generating a pulse via the TIMER1_COMPA interrupt and the circuit works when I test it ...
1
vote
1answer
210 views

How to fade LED in a defined time using FastLED

I'm using FastLED library, Arduino Nano and 5 addressable LEDs (WS2812B). I'd like to create the sequence in the image attached. (all in white color for example) I know how to turn ON each LED every 0....
12
votes
6answers
3k views

Using String instead of C string, yet another attempt to touch a loaded issue

I've been reading a lot over the years why we should not use the notorious String class and how heap fragmentation is bad practice and not professional and we should never use it in our programs or we'...
1
vote
1answer
561 views

Arduino parsing of a string using sscanf

Hello I am new to Arduino and C programming. I wanted to parse string using sscanf fuction This is my Program String hith; int field1,field2; float field3; int F1=0,F2=0; float F3=0; int h1,h3; float ...
2
votes
2answers
916 views

How to write nonblocking code, for polling sensor at 100 Hz

I'm using this piece of code to try to poll an IMU sensor at 100 Hz (for a AHRS sensor fusion library). void loop(void) { // nonblocking code variables static uint32_t last_ms; uint32_t ms; // ...
-2
votes
1answer
91 views

Do I use an LED or a pullup resistor for stopping "floating" or "ghosting" for a matrix keypad?

I know this sounds simple, but I have an Arduino Mega 2560 and I am making a matrix keypad for a claw machine. It's a 3*4 matrix keypad. Let's just say, I am making this keypad for the claw machine to ...
1
vote
0answers
29 views

1 Button + Potentiometer [duplicate]

Sketch arduino-uno programming 1 Button and 1 Potentiometer Sketch: Each time the button is pressed, acquire the value of the potentiometer in a array of 10 positions of these values do the average ...
3
votes
5answers
9k 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(...
2
votes
1answer
48 views

Arduino buzzer code sequence not triggering

I have a problem with my arduino buzzer: the code should be doing the following: I have a security system where in order to open the door you have to enter a 4 digit code from the remote. If the code ...
7
votes
6answers
16k views

how fast does loop() run in Arduino

Hi I am using Arduino Nano to gamify my experience on Unity3D. I know that Update() in Unity3D runs every frame per second but I because I'm not an electronics guy I don't know how loop() function ...
1
vote
1answer
1k views

Which Arduinos support ATOMIC_BLOCK?

Is there a definitive list of which Arduino architectures support the ATOMIC_BLOCK() macro, and a list of #defines for each architecture? I've tried searching through the Arduino cores on GitHub to ...
0
votes
3answers
328 views

Run multiple function with different argument/return structure by one function pointer

Edit: I tried a simple code in Arduino IDE which should've done in the first place instead in doing it in a desktop compiler. Because the results are different by experiment. In the desktop C compiler,...
1
vote
1answer
41 views

int array passed through function has wrong values only after multiple passes

I have this code: for(int i = 0; i < its; i++) { x1 = random(0,4); y1 = random(0,4); multiLamp(new int[2] {3,1}, new int[2] {x1,x2}, new int[2] {y1,y2}, wait, 2); multiLamp(new int[...
2
votes
2answers
7k views

Peer to peer communication

Hello guys , I want to perform a mesh network between 3-4 modules using ESP8266 . Any one have idea how to do it?
1
vote
0answers
31 views

Having trouble compiling in VsCode when including arduino libraries. (Win10)

I recently switched over to Visual studio code and away from the arduino IDE though I am a novice at both. When using VSC and the neopixel library and sample code(strandtest) containing animations ...
0
votes
1answer
183 views

esp32s: error: 'WDT_TIMEOUT' was not declared in this scope

I am trying to initialize the watchdog timer. I have installed arduino-esp32-master.zip I have #include <esp_task_wdt.h> set but it is not highlighted red indicating the IDE knows about it. ...
11
votes
3answers
16k views

How to call C functions from Arduino sketch?

I would like to know if there is a way to call functions that are contained within C files using an Arduino sketch? My C file declares and defines a function. To save putting the messy function ...
2
votes
2answers
1k views

Difference between char array and unsigned char array [closed]

I have written a small test code for Arduino Uno which is as follows: unsigned char tes[4]; char testing[4]; void setup() { Serial.begin(9600); for (int i = 0; i < 4; i++) { ...
-1
votes
1answer
71 views

Efficient workflow/tools for converting color images to hex arrays

I would like to display 65k color animated gifs on my oled. I'm using the adafruit library for https://learn.adafruit.com/096-mini-color-oled Now I need to convert a significant number of images to ...
3
votes
2answers
908 views

How to upload code without closing puTTY

My question is quite simple: can you, somehow, upload Arduino code without closing puTTY's serial console? I hate having to close the program to open it again for reading the incoming information.
-1
votes
1answer
316 views

GPS autonomous robot

I am working on a GPS autonomous robot using Arduino, HMC5883 compass, Adafruit GPS module and I have managed to sort of complete the coding for it and I tried compiling / verifying it and I get an ...
4
votes
1answer
110 views

Why does Arduino round off some integers but not others when my desktop PC does not do this?

I am writing (in C) some low level digit manipulation routines that convert int to float and vice versa for Arduino. I came across some puzzling behaviour with Arduino rounding some numbers but not ...
1
vote
0answers
55 views

Arduino LCD only display image for few second and turn screen to white

I have a problem with my Arduino and LCD touch screen. I create a few functional button in my Arduino. One of the button is START button. Right now, I want the image is display when I touch START ...
0
votes
3answers
304 views

Arduino does not work

When I try to upload a sketch to my Arduino Uno R3 then sometimes I get the following issue: At the beginning the RX LED flashes three times and then I get errors: avrdude: stk500_recv(): ...
3
votes
2answers
492 views

Switch case options get broken after a function call

I'm sorry for the basic question, but I have a switch case where any code placed after a certain function call simply never gets called, and I've spent half a day looking at it, so thank you so much ...
5
votes
4answers
2k 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. ...
0
votes
1answer
406 views

How to include a file from another (parent) directory

This is my structure program/ src/ Makefile main.ino test.h ... lib/ i2c.h In main.ino I include test.h and in test.h I'm trying to include i2c.h but it is just not working, I ...
-1
votes
1answer
77 views

Arduino waits until button release to activate

I'm fairly new to arduino, and on my own I'm trying to move a servo to the left and right using 2 buttons. I've got it working for the most part, however when I hold the button down nothing happens, ...
1
vote
1answer
162 views

Cannot compile F() macro with R"string"

I am trying to compile the following code: logger.log_info(F(R"(some text here that may take multiple lines and here it is done.)")); But the compiler exists with the following ...
3
votes
1answer
1k views

Using EEPROM to write a counter value

I have made a program that increments a counter everytime the up button is pressed. I am trying to write this value to EEPROM, so that when I turn my board off and on again, the value before power off ...
2
votes
2answers
1k views

Firmata: how to set a particular pin to high on boot?

I'm working on a project that use J5, so is using the standard firmata, this project is using an opto 4 channel relay, when the board is booting the pins state are set to low, so as soon as I power ...
0
votes
2answers
561 views

GPS logging on the intel edison breakout board

I'm working on my project car, and I have decided I would like to have a GPS and log some sensors too. I'm just at a bottle neck here, the sensors I have brought pull about 7v each where I can't pull ...
2
votes
1answer
633 views

How to send information from a web-site to the arduino?

I currently have an Arduino Mega + an Arduino Ethernet shield, I would like to know if it's possible to send data to the arduino from a web-site hosted on the shield itself. So that when someone press ...
1
vote
0answers
30 views

serially parse integer after serially read

I want to write below code but I don't know where I doing wrong, so please help me solve this issue. Serially read some text like number then I want to serially parse integer value into some variable ...
1
vote
0answers
38 views

Send message to multiple number

sim.println("AT+CMGS=\"+91xxxxxxxxxx\"\r"); I don't want to write this. I want to write mobile number on serial monitor in Arduino and on that number, i want to send message. how ...
1
vote
1answer
148 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 ...
0
votes
1answer
129 views

Arduino + Codeblocks C++

I'm writing the code for my Arduino board using Code::Blocks editor. When I create a new project, there is AVR Project and Arduino Project under Projects category. Which one do I select?
2
votes
1answer
2k views

Need help: Cast from 'char*' to 'uint8_t {aka unsigned char}' loses precision [-fpermissive]

I'm trying to convert the string that I receive from the Websocket to uint8_t that I can copy to the data bytes of CAN protocol frame. I'm using an ESP32 chip and programming it on an Arduino IDE. The ...
1
vote
1answer
81 views

PWM using timer3 for servo control won't generate any output

I'm making a program for a small robot arm controlled by four servos. Problem: I need for PWM outputs, timer1 has three so i need to use timer3 for the last one The main program and the timer1 ...

1
2 3 4 5
9