Questions tagged [programming]

The process of designing and writing source code as part of a program (or sketch) for Arduino. For questions about uploading code to an Arduino board, use the [uploading] tag instead.

Filter by
Sorted by
Tagged with
0
votes
1answer
34 views

How to find the peak value of analog signal?

I have a question .. Please help me I don't know how Arduino can read the peak value of the sensor signal. The value I want is in the ADC value .. What I want is ... for 5 seconds there will be 1 ...
0
votes
1answer
52 views

How to use any module that has no library for arduino?

I am 2 years old in this Arduino world. I am currently working on a project where I am about to make use of a fingerprint sensor. Now my question is that could we be able to make use of a sensor that ...
5
votes
2answers
2k views

Can we burn Arduino bootloader into any microcontroller chip?

I am new to this Arduino community I noticed on youtube that while the prototype is complete people purchase new ATmega328p chips and flash bootloaders into them using in-system-programmers so that ...
0
votes
0answers
60 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 ...
1
vote
1answer
57 views

Reduce Sketch Size Help!

I dont know what to do? Sketch uses 3712 bytes (12%) of program storage space. Maximum is 30720 bytes. Global variables use 210 bytes (10%) of dynamic memory, leaving 1838 bytes for local variables. ...
0
votes
0answers
35 views

HX711 Arduino library creation

I'm trying to create my own library for HX711. In that, I created a .h file and a .cpp file. There are some issues in my program. Please tell me what the error in the code is. hx711adc.h file-> #...
1
vote
1answer
54 views

I want turn the led off only when the input is low for a prolonged period of time and not when there are ups and downs in sound signal [closed]

My project is baby cry detection,when the baby cries the led must turn on and when it stops it should turn off, but I want it to turn off only when the baby has stopped crying , not when there are ups ...
0
votes
2answers
49 views

Is possible use Macro F() with Integer and Other types of variable?

i have a sketch that is using very memory RAM of my Atmega2560 (is a giant project), and i need use various "println" because i have a TFT screen and i need to show data on the screen to user see. So, ...
0
votes
0answers
19 views

Atmega168A won't be programmed via USB (Minicore) [duplicate]

I have designed a custom board based on a Atmega168A and a MCP2221 for the USB bridge. I successfully programmed the Atmega168A with an Arduino as ICSP with the following sketch (Minicore Atmega core):...
0
votes
2answers
188 views

Declaring and using array of structures in Arduino

Printing structure variables, I get default values. What is wrong with my code? struct SCENARIO { int Lamp_Pin = -1; int PB_Pin = -1; } ; SCENARIO _red; SCENARIO _yellow; SCENARIO _white; ...
0
votes
1answer
97 views

Pseudo-code of a program

I have written a code but I am facing a problem in pseudo-code that I am not able to change this code, so can anyone help me in translating the Arduino IDE program code to pseudo-code? #define ...
0
votes
2answers
54 views

Set slide potentiometer values

I am using the Grove - Slide Potentiometer (http://wiki.seeedstudio.com/Grove-Slide_Potentiometer). How can I set the potValue so that at maximum it will 128? int potPin= A0; int readValue; int ...
0
votes
0answers
33 views

Help with tachometer programme

This is my first programme, which is to control a brushless ESC motor and an IR sensor to read the props' RPM. However I can't seem to figure out why it's not working. The reading keeps giving me 0, ...
0
votes
2answers
137 views

How to exit while loop using keypad?

I can't seem to be able to escape a while loop using a keypad button. I've tried the solution from this thread: https://forum.arduino.cc/index.php?topic=79932.0 Here's my code: void alarm(){ char ...
-2
votes
1answer
59 views

Is it permissible to use strlcpy to copy an array to itself? [closed]

Task: delete "\n" at the beginning of the array. Example: char s_msg[15] = "\nHello world!"; void setup() { Serial.begin(115200); Serial.println("Load"); // Search \n if(strstr(s_msg, "\n") ...
0
votes
1answer
314 views

Connecting an Arduino Nano to a Raspberry Pi Zero

I'm working with an Arduino Nano Every, and I'm trying to connect it to the Raspberry Pi Zero for data collection from I2C sensors and writing/program code from the Pi to the Arduino. Typically, I ...
2
votes
2answers
330 views

Multiple Time-Sensitive Tasks

I'm using an Arduino Leonardo and need to perform two time-sensitive tasks like this: // Task 1 - Gets executed once a second (1Hz) // Execution of task needs approx 70ms task1(); //Sending a ...
-1
votes
2answers
53 views

Is it possible to get values only during vibration/movement from an Accelerometer(ADXL335/MPU6050)?

I'm trying to make a wearable motion sensor using ESP32 board and ADXL335 Accelerometer. Presently when I'm serial printing the output I'm getting the tilt value as well, which have different values ...
0
votes
1answer
160 views

How can I interrupt a delay() when a button is pressed?

I have created a device that allows my son to track time spent on activities and exchanges that time into a time he can use with his electronics (eTime). Full code in GITHUB I am having trouble ...
1
vote
1answer
824 views

cast double to long leads to unexpected results

I wrote a little program to show my problem: void setup() { Serial.begin(9600); double K=39.85; double a=K*100; Serial.print("a= "); Serial.println(a); long val_long = 0; val_long = ...
0
votes
2answers
30 views

default parameter class method

I have this function (which works fine): String Esper::rtcTimeString() { DateTime now = rtc.now(); char buf[] = "MM/DD/YY hh:mm:ss"; return now.toString(buf); } I'd like to have a default ...
0
votes
4answers
195 views

String to float on Arduino

I'm trying to convert a String to a float but I'm running into issues with precision, even with the Arduino's own String example I'm getting bad results. Example 0: Input string: 1.234567 After ...
0
votes
1answer
54 views

How to make a dynamic menu with a sub-menu ( Arduino mega or Arduino Uno)

I have an arduino mega with a LCD shield (from keyestudio KS2056). I am trying to create a menu with a submenu that would have addable and removable strings based on inputs from a RFID scanner(addable)...
-1
votes
1answer
66 views

Arduino recorder with SD card module

Can any one suggest me best device in cheap rates to record audio in to SD-card and vice versa from the speaker......i want to record audio into the sd card like as feedback from customer
0
votes
1answer
172 views

Continous running light with fading trail

In examples of FastLED library, there's the animation of a dot sweeping back and forth, with fading trails (file "DemoReel100", animation "sinelon"). How can I alter the code so instead of moving back,...
0
votes
1answer
40 views

MCU to MCU communication over UART

What would be the best way to send the following information from one MCU to another? Now I'm just sending the sentence over as is eg. Serial.print(sentence in here) Example sentence: 1306,60.123456,...
0
votes
2answers
51 views

A problem with measuring time in a for loop

I am familiar with timing using millis() function, but it seems that I have run into a problem with a for loop. The thing is, I am comparing encoder readings with a value entered via 4x4 keypad. Since ...
0
votes
0answers
31 views

RF24 code not working:

I watched this video and used his transmitter code and receiver code. However, it's not working. There's no response from the receiver. The transmitter stuck at the loop: if (!radio.write( &data,...
1
vote
1answer
37 views

My millis() code doesn't work

I am doing a project with bluetooth and an LED. I wrote a code which supposed to turn on an LED after it receives a byte of value 1 after 5 seconds, unless it receive another byte of value 1 (which ...
0
votes
1answer
61 views

Piezo buzzer with PWM on arduino uno with atmega328p in C on registers + analogRead on registers

I have a little project at the university where I have to use the timers to generate a pwm signal and get it into a piezo buzzer when something else turns over a certain value by using the registers, ...
-2
votes
1answer
24 views

L298N Motor Driver - Code issuing “expected primary-expression before '=' token”

Programming Questions / L298N Driver - Code Issuing - " expected primary-expression before '=' token" Today at 07:20 pm Hello Arduino Community, Code is shown at bottom - please read below I've been ...
0
votes
0answers
19 views

Is Arduino code reversible? [duplicate]

I plan to create an Arduino that only responds to a specific input from the sensors. But really, I am not sure how secure would it be. Can the binary inside Arduino be converted back to its source? ...
0
votes
0answers
19 views

I want to code a countdown code that resets periodically for arduino [duplicate]

i am looking forward to do my first arduino project, but I'm a little stuck on the coding. I want to make an alarm that turns on when it is disconnected from bluetooth of smartphone. My idea on how ...
0
votes
1answer
130 views

Using serial communication in .c-files

I am currently trying to connect my Arduino Uno to my computer and let them communicate via UART. I started using a project from Github (here), which I'm trying to modify to get the next step via UART....
0
votes
1answer
38 views

How to burn bootloader and upload sketches on custom arduino?

Ive turned a project I breadboarded with arduino and other modules into one pcb on EAGLE. The pcb includes the ATMEGA328p smt version that doesn't have the bootloader installed. My question is then ...
0
votes
2answers
115 views

Coding issue with for loop

I have an issue with this piece of code concerning the use of 3 capcitance sensors each outputting a midi note chosen from one of three scales selected with a pot. Regarding the sensors triggering ...
1
vote
1answer
25 views

How to (optimally) fetch a button press? [duplicate]

For my hardware, I need to check if the button was pressed, but I need to do things only once every half a second. if (digitalRead(pin) == HIGH) { doStuff(); delay(500); } The above does ...
0
votes
4answers
45 views

How to link a computer processor to an Arduinno on a board? [closed]

I am completely new to Arduinno, so please forgive if the question is stupid. Here is the problem: I have a project where I want an Arduino (or similar microchip board) to handle some sensors and ...
1
vote
2answers
55 views

Mixed structure with int and string

I want to create a structure like this: struct commands { int cmd; char descr[25]; }; commands cmds[] = { {16, "Hammond Organ"}, {17, "Percussive Organ"}, {18, "Rock Organ"}, { 0, "" ...
0
votes
0answers
22 views

How to parse const char* for get data? [duplicate]

There is a variable like const char* date = "2019-12-16T18:30:58.708Z" I want to extract individual values ​​from this variable, such as: day, month, year, hour, minute, second Tell me, how ...
1
vote
1answer
202 views

ESP8266 Webserver ESP8266WebServer variable html page (not as one const char)

The aim is to display a non-static html page depending on some variable condition. The code I created hast the problem, that the esp8266 is ressetting in the moment I request the page. const char ...
1
vote
1answer
253 views

ESP8266 Webserver ESP8266WebServer move Handler-Function in separate .h .c file

The plan is to create a bigger project and to split the ESP8266 webserver-code over several modules (.h .c files). The main problem is that the ESP8266WebServer server is not declared in the index.h ...
0
votes
1answer
133 views

How to use H3LIS331DL 3-Axis Linear Accelerometer with arduino to detect Harsh braking of vehicle

I am a newbie here, Recently I was working with H3LIS331DL 3-Axis Linear Accelerometer I²C Mini Module Here is code for the X, Y, Z-axis. #include <movingAvg.h> #include <...
4
votes
1answer
539 views

Useless box wiring and code

just want to give a back story first. So i saw this video on youtube about the useless box, and i thought that it would make a great gift for my 7 year old. So i went out and bought everything that ...
-1
votes
2answers
80 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
1answer
106 views

Use JYETech 2.4 Inch LCD Display Screen Module with Arduino?

I have this JYETech 2.4 Inch LCD Display Screen Module that I would like to use for a project I have in mind, however, I'm not sure how to wire it up with my Arudino Mega. Here is the datasheet for ...
-1
votes
1answer
27 views

ARDUINO flashing lights

I'm making a circuit with my Arduino so that when it receives a '1' or '2' or 'a' it turns on or off the LEDS. But I wanted the lights to flash and do not know how to do loops in loops or if that's ...
0
votes
1answer
52 views

I need some help getting data from a rangefinder

I have wired up my range finder (CJVL53L0XV2) to a breadboard for testing and have run the arduino example code for the rangefinder. The rangefinder works, but I do not know how to take the distance ...
0
votes
2answers
58 views

How do I segment Arduino program when line count is so large that code maintenance is difficult?

I'm looking for the Arduino/C++ equivalent of COBOL's 'copy' statement. I'm working on a program that is approaching 600 lines of code in the TopLevel.cpp source file. This is hard to manage ...
0
votes
0answers
85 views

SPI communication with Arduino and PGA411-Q1 resolver sensor

I have been trying to implement SPI communication between an Arduino board and a PGA411-Q1 resolver sensor board. I have set up the Arduino SPI settings as indicated on the resolver sensor's datasheet ...

1
2
3 4 5
29