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
1
vote
1answer
27 views

How to detect patterns in an FFT output?

I have an FFT output from a microphone and I want to detect a specific animal's howl from that (it howls in a characteristic frequency spectrum). Is there any way to implement a pattern recognition ...
-1
votes
0answers
23 views

how to Use <SoftWire.h> _ MCP4725 for see analog out with Osc [duplicate]

i use softWire.h and want to send int value to SDA pin of the MCP4725 and take analog output and see that with Osc note: i receive int value with wemos ------- adc is my int value and boths is 12bits ...
-2
votes
0answers
29 views

If-Condition sensor

Can someone help. I need to do, that when sensor is covered for 350ms (Sensor 1)is LOW and if sensor less covered than 350ms ( Sensor 1) HIGH, and when (Sensor 2) HIGH active pin 5 output. Becouse ...
0
votes
1answer
25 views

Modular Coding - What types of code portions to convert into library files? Rationale and methods?

I'm working on documentation and combining 2 pieces of code for testing parts of a larger project. My supervisor told me to comment and make the code very clear to people who will use it later and ...
2
votes
2answers
60 views

DS18B20 with only OneWire library

Peter Scargill found a way to use DS18B20 temperature sensor without any library and just using OneWire library, and it's amazing how blazing fast it is! (it's an old article from 2013) #include <...
0
votes
0answers
15 views

How to adapt this code using a DF Mini Player and interrupts for the ATTiny85?

So I programmed my Arduino Mega 2560 to play certain sound effects from a DF Mini Player that I have. I took the base code that I modified from online so some fo the names might seem odd. Currently, ...
0
votes
1answer
32 views

Do we have an alternative for millis() function?

This is actually a follow up question to this question, so basically I'm using DS18B20 temperature sensor which requires Onewire.h library that interrupts millis() function. Luckily i have a DS3231 ...
0
votes
3answers
41 views

RTC timer set point problem

This is the timer part of my code: int onHourONE = 11; int onMinuteONE = 00; int offHourONE = 23; int offMinuteONE = 00; byte PWMstatus = 0; void setup{} void loop{ if ((now.hour() >= ...
-1
votes
1answer
66 views

Refactoring bad design?

Could someone help me how to refactor old very complex code ? Original used just setup and everything else was in single ISR. But as it was bigger and bigger, code is quite slow and quite random ...
1
vote
1answer
98 views

How to NOT repeat a piece of code again and again?

I have a VERY long code: Sketch uses 30468 bytes (92%) of program storage space. Maximum is 32768 bytes. I've been trying to reduce it's size so i can write more code, one of my main part of ...
0
votes
0answers
76 views

Having problem in coding Arduino Uno

I'm making a timer program which takes the Time Duration as input from the user by two button switches (one for 'up' and one for 'down'), and after pressing an another button switch ('start'), the ...
-2
votes
0answers
19 views

I have a problem uploading to ANY Arduino [duplicate]

I suddenly could no longer upload a compiled program to any of my Arduinos. This would be regardless of the program..mine, examples, or basic,even! I just got a new system and I can't get it to work, ...
0
votes
0answers
41 views

Using the YS-IRTM with an Arduino Uno

Picked up a YS-IRTM IR Transmitter/Receiver module to do some testing for a project. There's not a lot of details on it but eventually came across two very important sources: Translated Module ...
0
votes
1answer
20 views

Using case statement with IR emitter reciever

I am trying to use two "infrared obstacle avoidance modules" to work with the following sketch. From all my research, I believe, a case statement is my best option because, (I understand) the sketch ...
-1
votes
0answers
43 views

How to receive data from RS485 drive on Arduino UNO?

I want to connect Arduino UNO with V20 drive Sinamics and V20 communicates on RS485. Actually I want to read a particular register in which the drive is sending data.I tried many programs and used a ...
0
votes
0answers
34 views

Bootloader to upload “.hex” from SD card for 32 bits arduino boards [on hold]

i´m looking for a project based on the principle used by Phoenboot and Nick Gammon, that uploads a .hex file from sd to another arduino but for 32 bits, i know the process is way more difficult than 8 ...
0
votes
0answers
24 views

UV sensor help!

I am creating a uv sensor. The sensor detects a certain amount of UV light and turns on the respective light (eg uv of 1-3 turns on a blue light). However I am getting an error: "expected primary-...
0
votes
0answers
20 views

Accel Multi Stepper - Array for timelapse operation

I am trying to run 2 cameras for timelapse. I can do this with a single stepper: void doSteps(long steps) { calcSpeedStepper(); digitalWrite(sleepPIN, HIGH); stepper1.setCurrentPosition(0); ...
-1
votes
1answer
32 views

Error: exit status 1 stray '#' in program [closed]

I got this error: exit status 1 stray '#' in program How can I remove this error..? int keys = {1,2,3,A,4,5,6,B,7,8,9,C,*,0,#,D};
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;...
3
votes
1answer
38 views

writting to buffer from serial input

Can some one explain this behaviour please, i have the following code byte buffer[512]; byte block; byte len; Serial.setTimeout(60000L) ; // wait until 20 seconds for input from serial ...
-1
votes
1answer
32 views

expected unidentified id before 'if" [closed]

#include <iostream> using namespace std; char board[3][3]={{'1','2','3'},{'4','5','6'},{'7','8','9'}}; char turn='X'; int draw=0; int row,column; void display_board() { system("cls"); ...
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 ...
0
votes
1answer
47 views

PWM delay without blocking the code

I want my LED to turn on gradually without using the delay() function and blocking the code. Here's the code i came up with: int led_pin = 6; unsigned long millisTimer = 0; int PWMdelay = 5000; int ...
1
vote
3answers
51 views

class enum was not declared in this scope

I am programming an Arduino. In the same .ino file as setup() and loop() I have defined the following: void setup() { // setup code } enum class CYCLE { TypeA, TypeB }; String cycleToString (...
0
votes
0answers
14 views

HC-05 Bluetooth AT Mode

I know that I need to pull pin #34 high on the HC-05 "chip" (AKA PIO11) while powering ON the chip in order to put it into AT mode. Can I leave that pin high while programming, or does it need to go ...
2
votes
1answer
45 views

Is it possible to execute a code in runtime when gets updated over the air (OTA)?

I would like to build a lib like ArduinoOTA but with no downtime at runtime. To achieve that I am wondering if it is possible to create a simple setup and loop code to Check for new releases If we ...
0
votes
1answer
35 views

Combining code for multiple sensors in one program (Arduino)

I need to operate 2 different sensors (gas and DHT11) simultaneously. I have managed to run each one of them separately and I don't know how to manipulate the code so they could work together. Here ...
0
votes
1answer
52 views

Help combining digital and analog code in arduino programming

So I'm making a device that does 3 things, Measures frequency of an audio signal through a microphone Checks whether there is a weight placed on a pressure pad (my pressure sensor works through the ...
2
votes
1answer
90 views

How to repeat an IF statement

My LCD info is called from an IF statement but since it's clock and temperature info i don't want to just show the information but update the information constantly in real time. i don't want to use (...
2
votes
1answer
61 views

The arduino can't seem to output correctly

i am a beginner at python and I am average at Arduino and I had the idea of using both of them together for a project. I have been trying to make a Arduino + Python car which I can control with my ...
0
votes
2answers
89 views

How to automatically reset the NRF24L01 module

For my home-automation project I'm using several arduino nano's with each a NRF24L01+ module. Each module is able to both receive and transmit with one another. Everything seemed to be flawless for a ...
0
votes
0answers
44 views

Is it possible to convert RCA(video only) to Arduino Uno then to a computer?

I have an old wireless RCA output camera. I was wondering if I can convert its analog input to a digital one and have it saved on a file in my laptop?
0
votes
1answer
66 views

New to arduino, help wiring relay

I am new to arduino and need some help. I just baught light bars for my jeep and wiring harnesses with them, the harnesses come with buttons and I wanted to replace the button and have them controlled ...
0
votes
3answers
79 views

All floats feedback a rounded down integer

So I am very confused at the results I am getting. It seems that floats aren't working properly, and I don't understand why. I was trying to read a temp sensor and convert the reading to celsius. ...
0
votes
3answers
66 views

How to independently control two lights with a single button and a menu system?

I'm stuck and don't know how to get over it. The problem: i want to use a push button for a menu with 2 screens(frames) Frame1: if i push the button i want to turn on the light from the room1 ...
0
votes
1answer
96 views

Run a loop for only 60 secondes

How do run a code on arduino for only 60 secondes and than shut it down? I know I have to use the millis() function, but I do not know how to it in my code. Sorry if it looks unclear, but I only need ...
0
votes
0answers
22 views

Activate camera module(OV7670) with ultrasonic sensor(HC-SR04)

I want to use ultrasonic sensor(HC-SR04) to activate my camera module(OV7670) and capture images. When HC-SR04 detects an object is less than 15 cm away from it, camera needs to start working and take ...
0
votes
1answer
66 views

Include guards vs #pragma once [closed]

Is there any particular reason why #pragma once doesn't seem to be used in Arduino code? Is this just because it's not a well-known feature, or is there some overriding reason to use #ifndef XXX_H/#...
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
1answer
41 views

LED blinking issue

i made a distance measuring circuit with different led for different distance ranges #define trigPin 13 #define echoPin 12 #define BPin 7 #define piezoPin 9 #define RPin 4 #define GPin 8 void setup(...
0
votes
1answer
66 views

Please help me combine the two codes for DHT11 and SW-420 Vibration sensor for arduino in one program [duplicate]

The following is the code used for DHT11 Temperature and Humidity sensor: #include <LiquidCrystal.h> LiquidCrystal lcd(4, 5, 0, 1, 2, 3); byte degree_symbol[8] = { ...
1
vote
1answer
50 views

Segmentation fault and huge SRAM need for Serial.println

I have written my own 'assert' since I want to use it for both Windows and Arduino. The class is called from many files (about 10). AssertUtils.h: #pragma once #define assert(expr) AssertUtils::...
1
vote
0answers
45 views

ARDUINO PROGRAM

I have a project that consists in measuring the mass of an object with a strain gauge HX711. so I found an interesting Arduino program and the editing that goes with it. but I have a problem, I ...
0
votes
1answer
17 views

Programing AVR 32u4 via ISP with other ISP device connected

I have a custom PCB with an Atmega 32u4 chip. I program the chip with AVRDUDE via ISP after it is has been mounted onto the PCB. All is well. I now want to add wireless capability via the NRF24L01. ...
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
votes
1answer
28 views

Code and wire a LCD and button [closed]

I need to code and wire: “Button is pressed.” to an LCD screen when a button is pressed. When the button is released, the LCD should display, “Button is released.” NEED HELP!!!
0
votes
1answer
37 views

128x64 and pushButtons

Could someone give me some advice related to building a menu for a 128x64 LCD using 5 pushButtons? i have 5 screens. btn1 is for display MainMenu and Selection. btn2 and btn3 is for up and down ...
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
0answers
23 views

Power Factor Measurement

I'm developing a system to measure the power factor between two waves and using a XOR to get the time between them. The programming and the circuit seems fine but some times I get the power factor as ...