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
2
votes
1answer
46 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
47 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
63 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
100 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
67 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
168 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
47 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
73 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
103 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
69 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
99 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
63 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
234 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
52 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
64 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
72 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
56 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
53 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
21 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
33 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
33 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
44 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
29 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
49 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 ...
0
votes
0answers
34 views

Need Help Understanding PS2X Library

I bought an Arduino Tank recently that uses the PS2 controller and receiver. It comes with the PS2X_lib Library and I couldn't get a good grasp of what some of the functions do. Question: In ...
1
vote
1answer
25 views

Press one button then another?

Let's say we have two buttons - button 1 and button 2. What I need to do is to do something (like turn LED on) when button 1 is press, then button 2 is pressed. I can do it realy simple by just using ...
1
vote
1answer
86 views

How Programing the nodeMCU Through OTA using GPRS?

How Programming the nodeMCU Through OTA using GPRS? Hi Everyone I need big help. Actually, I m using NodemCU one of my project. the setup in Remote location, that place dont have a wifi option so I ...
0
votes
0answers
11 views

Trouble running two NEMA 17's with a joystick

So I'm trying to make a motorized dobsonian telescope using two NEMA 17 motors with Easy Driver boards. I want to control the x and y axis with a joystick. I found a code that ran one with a joystick ...
0
votes
0answers
30 views

ESP8266 accepts commands but returns nothing

I've been struggling for a couple of days now with the module ESP8266. I have tested it already with another Arduino (RX-RX / Tx-TX) and I could send some test commands and receive the corresponding ...
0
votes
1answer
53 views

exit status 1 'mySerial' does not name a type

I just can't make it work for some reason. I tried #include <SoftwareSerial.h> and I tried #include "SoftwareSerial.h". Can someone help me? #include <SoftwareSerial.h> SoftwareSerial ...
0
votes
0answers
42 views

i2C master/slave Arduino uno Programming to run 2 motors at once off separate boards [duplicate]

I am attempting to run a master/slave receiver arduino using two arduino uno's. I'm synchronizing both Arduino to control 1 dc motor and 1 stepper motor at once which each of the Arduino UNO board ...
1
vote
1answer
248 views

declared variable inside void setup is forgotten in void loop

if i declare a var in void setup() and try to do something with it in void loop(), it just says that the variable is undeclared. here is the code: #include "Servo.h" void setup() { Servo servo1; ...
0
votes
1answer
109 views

How to use PROGMEM in a .h/.cpp file instead of a .ino file?

I want to use a lot of .h/.cpp files to be used by my ino sketch. In one of these .cpp files (and later more) I want to use constant arrays (like lookup tables). To save SRAM I want to use PROGMEM. ...
2
votes
2answers
242 views

Why does a variable size struct not compile in the Arduino IDE?

This sketch does not compile in the Arduino IDE void setup() { // put your setup code here, to run once: } struct test { int i; char variable[]; }; typedef struct test test; test t = { 0, ...
1
vote
2answers
51 views

Is new without a delete acceptable?

I know it is not a good practice to use the new command to dynamically create data, however, if I would never use the delete, would it result in memory gaps/other problems? Background The reason I ...
0
votes
1answer
58 views

Nodemcu ESP12-E (ESP8266), Can I reprogramming when the UART pins are defined as GPIO?

I wonder if there may be any problems using the pins that the UART are using as GPIOs, if now I want to be able to reprogram the circuit? (Of course I will detach the ESP12-E from the mainboard before ...
1
vote
0answers
53 views

Clear Timer on Compare or CTC in ATmega328P, Toggle OC0A on Compare Match

I want to use the CTC on the ATmega328P to play same notes with a speaker, a project that I find in this book. In the data sheet I read: For generating a waveform output in CTC mode, the OC0A ...
1
vote
1answer
163 views

Read the value of a register in arduino

I want to read the value of the register (8-bit). In particular I want to read the values of: The Timer/Counter - TCNT0 ( Adress 0x26 (0x46) ) The output compare registers - OCR0A and OCR0B. Is ...
0
votes
3answers
42 views

Arduino keeps looping

I made a program where I give a number(4 bit) as input and four led on the breadboard lights up according to its binary. The problem is the program works all well only for (2-15) but if I give 0 or 1 ...
1
vote
1answer
24 views

Is new.cpp programmed improperly? Arduino 1.8.9

I'm having trouble with my code and I'm not sure if it's a memory allocation issue. So I look at the new, delete to see if it throws errors, and finding the source code I find outrageously simple ...
1
vote
1answer
75 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
2answers
43 views

Questions about HMC5883L library

I'm studying the structures of libraries currently. I want to learn how good programmers write code, what are the strategies they follow, the art the programmer followed to develop the library. And ...
0
votes
1answer
23 views

Implementing sending from N and recieving from N with FreeRtos and RF24 radio module

I'm trying to make my first chip send data through a nrf24 radio pipe and the other listen to it. After the first data is received it should switch to transmit mode and itself transmit new data. The ...
2
votes
1answer
40 views

`LOW` being defined as `0` and `HIGH` being defined as `1` - is this a part of external specification?

Arduino.h defines LOW as 0x0 and HIGH as 0x1. Does the Arduino API intend to expose that fact? Does it guarantee that this will always be that way? In other words, what is the intended purpose of ...
0
votes
2answers
45 views

How to write a function to return matrix?

I need a function to return a 2x2 rotation matrix, something like: float matrix(float phi){ float R[2][2] = { {cos(phi), -sin(phi)}, {sin(phi), cos(phi)} }; return R; } But ...
0
votes
1answer
48 views

nodeMCU - 2 loops at a time - one continuously and second every 10 seconds

i have nodeMCU v3(esp8266) so i need to make 2 checks 1 check is the pin D1 which needs to be done continuously and another check is web link check every 10 seconds, problem is coz when i put delay ...
1
vote
1answer
1k views

'Var' does not name a type!

I don't have much experience in C++ programming. I'm getting this error 'z' does not name a type!!! which I have't seen in MATLAB or python... What's wrong??? It is so simple!!! float x=10; float ...
1
vote
1answer
113 views

STM32YYXX chip series is not defined in boards.txt

The STM32YYXX chip series is not defined in boards.txt? How can I solve this? I am using Windows 10 with Arduino IDE 1.6.6
0
votes
0answers
85 views

Fastest way to convert binary string to a number?

I am using a Teensy 3.2 board as control logic for an ADC that I am building for teaching purposes. Currently, I am employing an attachInterrupt() to detect the rising edge of an external clock pulse ...
0
votes
1answer
39 views

Help with coding Arduino Nano to run fan through slide switch at specific intervals

I’m trying to use Arduino Nano to run my 5 V PC fan, which, I know it sounds crazy, it’ll be mounted on a piece of Tupperware that’ll control the airflow through it via the fan. However I have no ...