2022 Developer Survey is open! Take survey.

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 votes
0 answers
24 views

How to reset a main loop, by clicking on specific button on keypad?

How I can reset loop, and couple of variables by clicking some button on keypad? What I want to do is: whenever user click on 'C' button, the loop should be reseted, just like we hit the red button on ...
user avatar
-2 votes
0 answers
33 views

Can't store data in array [closed]

How to store numbers given by a user in an array? I have something like: int firstValue[3] = {}; for (int i = 0; i < 3; i++) { firstInput = customKeypad.getKey(); if (isDigit(firstInput)){...
user avatar
-1 votes
0 answers
22 views

Can't pass value to the integers in function [closed]

I'm trying to make calculator, with some FSM. Here's some code: getOperationTypeFunc char getOperationTypeFunc(char userInput, int number){ // userInput = customKeypad.getKey(); switch (...
user avatar
-1 votes
1 answer
46 views

Can't get input from 4x4 keyboard

I'd like to make some basic calculator. Currently, I'm struggling with inputs. I wanted to get from user some numerical input, then, I'd like to have an information, which type of calculation he is ...
user avatar
0 votes
1 answer
37 views

Compare interrupt enabled in overflow interrupt behavior is not as expected [closed]

What I'm trying to do: Drive a DC motor using Arduino UNO Control PWM duty using a variable resistance and built-in A/D converter Write a program in C with direct access to the registers Target ...
user avatar
  • 27
-1 votes
0 answers
22 views

Getting weird outputs while trying initialize variables by output from keypad [duplicate]

I've got some "arduino begginer set" a couple of days ago, and I've wanted to make something else than just playing with the diods. I'd like to make some basic calculator, but unofrtunately, ...
user avatar
2 votes
1 answer
344 views

lcd.createChar() only allows for 8 custom characters

I have a teensy4.1, with a 16 by 2 LCD screen, and an I2C LCD interface. I was trying to write a bunch of custom characters to an LCD screen, to flip some text. my issue is that it works fine, but on ...
user avatar
  • 838
2 votes
1 answer
130 views

How to process 20-bit sensor data

I have an acceleration sensor (ADXL355) that returns 20-bit data in three bytes, formatted as 2s complement : acc3 (bits 19-12) in byte register 3 (mapped to bits 7-0) acc2 (bits 11-4) in byte ...
user avatar
4 votes
1 answer
303 views

How arduino PORTB pins are addressed if I want to access them with pointer?

So Let say I want to access Digital Pin 13. Thats port B pin. Is there an memory address associated with this pin 13 of Arduino Uno r3? How Port B pins are addressed with corresponding pin numbers ...
user avatar
  • 145
0 votes
1 answer
38 views

Do I need to use resisters and ICes for specific sensors.What if I dont use it,Will it impact my arduino board some how like making it useless &faulty

So I was reading about Simple AutomaticLight Controller using LDR. or with the help of LDRSenso. But I have LM393 Photoresistor (LDR) Sensor I like to know are they same thing or somewhat different. ...
user avatar
  • 145
1 vote
1 answer
76 views

Why use multiple filters output thousands value, use one or two filter can output normal value?

Problem If the loop runs only one simulated pin and uses a filter, it will output normally (analog 1600~2200, filter 0~500), but creating an array to store multiple filtered simulated pin values will ...
user avatar
  • 45
2 votes
1 answer
163 views

How to build an arduino project with multiple source files?

I'm building an arduino program on linux, using the following Makefile: ARDUINO_DIR = /usr/share/arduino BOARD_TAG = uno ARDUINO_PORT = /dev/ttyAMA0 ARDUINO_LIBS = Wire include /usr/share/arduino/...
user avatar
1 vote
1 answer
52 views

Morse encoder code not working as expected on Arduino UNO [closed]

I'll start saying that I don't have much experience working with Arduino and programming in C. I have an Elegoo Arduino UNO clone. Recently I was trying to build a morse encode which converts a text ...
user avatar
  • 53
1 vote
0 answers
62 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 ...
user avatar
1 vote
1 answer
55 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 ...
user avatar
1 vote
1 answer
514 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....
user avatar
12 votes
6 answers
4k 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'...
user avatar
  • 391
1 vote
1 answer
2k 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 ...
user avatar
2 votes
2 answers
945 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; // ...
user avatar
-2 votes
1 answer
158 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 ...
user avatar
  • 101
1 vote
0 answers
32 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 ...
user avatar
1 vote
1 answer
54 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[...
user avatar
  • 113
2 votes
1 answer
54 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 ...
user avatar
1 vote
0 answers
47 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 ...
user avatar
  • 11
0 votes
1 answer
290 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. ...
user avatar
  • 201
2 votes
2 answers
2k 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++) { ...
user avatar
  • 247
-1 votes
1 answer
99 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 ...
user avatar
0 votes
3 answers
459 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,...
user avatar
  • 183
3 votes
2 answers
946 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.
user avatar
4 votes
1 answer
143 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 ...
user avatar
  • 173
1 vote
0 answers
65 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 ...
user avatar
  • 11
3 votes
2 answers
587 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 ...
user avatar
  • 71
0 votes
1 answer
671 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 ...
user avatar
-1 votes
1 answer
108 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, ...
user avatar
1 vote
1 answer
231 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 ...
user avatar
1 vote
0 answers
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 ...
user avatar
  • 31
1 vote
0 answers
41 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 ...
user avatar
  • 31
0 votes
1 answer
196 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?
user avatar
  • 103
2 votes
1 answer
4k 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 ...
user avatar
1 vote
2 answers
652 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 ...
user avatar
  • 11
5 votes
2 answers
887 views

Jumping to bootloader from application code in atmega328p

I'm trying to program an Arduino Uno (atmega328p) using only the serial Tx/Rx lines (no DTR, so no automatic reset). This is so I can upload code via WiFi/TCP using an ESP-01. To achieve this, I need ...
user avatar
  • 63
2 votes
0 answers
92 views

Arduino EPROM dumper with utility program in C

I am writing EPROM dumper with Arduino UNO and utility program in C and I am using Ubuntu 20.04. The Arduino sketch works fine, but I am having few problems with the utility program. The first problem ...
user avatar
  • 21
1 vote
1 answer
2k 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 ...
user avatar
  • 629
1 vote
1 answer
255 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 ...
user avatar
1 vote
2 answers
1k views

How to convert Unicode char to “Unicode HEX Position” in Arduino

How to convert Unicode char to "Unicode HEX Position" in Arduino or C i will share a picture here : for example in JavaScript you can do that with charCodeAt(); ! this function will return ...
user avatar
  • 13
0 votes
2 answers
58 views

Add char at intervals in a String

I'm trying to create a function that will take a String as an input, and at every 20 characters, it will instert "\n" so that the string doesn't go off the side of my screen (I'm using an ...
user avatar
1 vote
0 answers
178 views

How do i efficiently write this code for PS2 controller to USB convertion sketch for Arduino Pro Micro?

I am really new to coding and building stuff, so forgive me if it is anything offensive.i have been trying to convert my PS2 dualshock controller to USB using arduino. there is a library called ps2x ...
user avatar
1 vote
0 answers
432 views

Display GPS module data to my TFT display

I am using Arduino Mega 2560 and I have written code for my GPS module (Neo-6m-0-001/GY-NEO6MV2) and it is working fine independently. I also have written code for Compass module (QMC5883L) which is ...
user avatar
0 votes
1 answer
1k 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> #...
user avatar
0 votes
1 answer
75 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 ...
user avatar

1
2 3 4 5
9