Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

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
1 answer
31 views

Round to first significant digit

I want to round a decimal number (x), but I need to do it differently depending on how it is. If it has integer significant digits, we round to the nearest integer, and if not, we round to the first ...
user avatar
1 vote
0 answers
33 views

FastLED changing colour at holding state

Basically make a code to guide users through a box breathing exercise (breath in for 4 seconds, hold for 4, release for 4, hold again for 4, repeat) to help relax them. Right now my code is running ...
user avatar
1 vote
1 answer
75 views

Arduino create Json Array with double values and 2 decimal point

How i can create a Json Array with double values and 2 decimal point using the ArduinoJson Library? https://arduinojson.org/v6/how-to/configure-the-serialization-of-floats/ In the folowing small ...
user avatar
-1 votes
1 answer
24 views

Externally powering Arduino while reading voltage off it via USB

I have an Arduino UNO R3 where I’ve set Pin 13 to “HIGH” (as shown here) and I’ve connected an LED to Pin 13 and GND which glows brightly using a USB attached to my MacBook Air providing (I think) 5V. ...
user avatar
0 votes
0 answers
47 views

Why does the water sensor chip get very hot?

I have a water sensor like that in the image, but when I connect it to 5 V and put it partially in a cup of water, I can read the input value in my Serial, but the black chip in it gets very hot. I ...
user avatar
-1 votes
1 answer
36 views

How To Repeat a the specific Code in Void loop() No Of Times

Hello Friends i Am creating a dc motor controller (for leg extension machine) which moves motor between two points specified by two potentiometers and as a feedback third potentiometer is used my code ...
user avatar
-1 votes
0 answers
32 views

How do I remove the second and third readings from an ESP32's capacitive touch sensor?

Serial monitor open: 82 open: 80 open: 88 open: 81 open: 80 open: 88 x: 8 open: 79 open: 88 "8" is the first reading (of me touching the wire) "79" and "88" are the ...
user avatar
  • 45
2 votes
1 answer
345 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
1 vote
1 answer
40 views

What is my code lacking that the servo rotates non-stoppingly? Servo should rotate 180 when distance is <= 50 and 0 when this condition is not true

My code represents a water level sensor, and the components are the Arduino Uno, a breadboard, an ultrasonic servo and two LEDS in which one is red and the other is green. The condition that I don't ...
user avatar
-1 votes
1 answer
37 views

Displaying multiple temperature outputs w/Thermistors

So I asked this question a couple days ago but did some more work with some of the coding, but I'm really stuck and need some help. I'm trying to display the temperature for each separate thermistor ...
user avatar
0 votes
1 answer
51 views

How to get started with writing code for a Hall Effect sensor?

One of my biggest questions concerns coding a Hall effect sensor to find wheel speed with an arduino mega. I’ve got an lcd in digital pins(7,8,9,10,11,12) and a Hall effect sensor in digital pin 2. I ...
user avatar
2 votes
1 answer
164 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
86 views

Uploading to an external Atmega328P with a clone UNO R3 with soldered chip

As a complete newbie, after much looking for the best bargain, I ended up buying one of these UNO R3 clones, without realizing it had the chip soldered on the board. It looks like this: It works OK ...
user avatar
  • 121
0 votes
1 answer
60 views

How I can use more than 64 analog in arduino

Hi dears I want help I’m in begging in programming. I want use more than 64 analog pin for ldr photoresistor in single reading. Because I can’t use digital pin 0-1. Any methods I can use ,,,, And ...
user avatar
0 votes
1 answer
100 views

Convert from raw data to float from DDSU666-H

Hi professers, i am trying to read the data from DDSU666-H ( Smart metter) CHINT using modbus RTU, i only get the raw data but i don't know how to convert it to float , in the code below is about ...
user avatar
3 votes
1 answer
91 views

How do I run 4 LEDs sequentially based off of a push button input?

I am trying to create a program that runs 4 LEDs sequentially while also being able to do other things with different inputs and outputs. Because of this, I am using the millis function and not the ...
user avatar
  • 73
-1 votes
1 answer
75 views

Pressed Buttons are permanently low and one of them is not working [closed]

I am a beginner to Arduino, and I'm having a problem in a project that I am currently working on. I was just beginning to write the code, after preparing the components and the wiring, and suddenly ...
user avatar
0 votes
1 answer
182 views

7-Segment Display w/ Potentiometer

(Backstory) So, I took an computer engineering class in high school (grade 11 level), where I learned a bit about breadboarding as well as arduinos (I would like to stress a bit). It has been 5 years, ...
user avatar
  • 3
1 vote
1 answer
28 views

RF Keyfob single button code

I'm making a project where a 2 channel RF keyfob (433Mhz) controls an led using arduino nano. As for the hardware everything works and I have tested it with the example decoder code and it works fine. ...
user avatar
  • 123
0 votes
1 answer
31 views

Having issues Connecting to a web server and pulling the data back

I have some arduino code where I am trying to pull information from four different locations. Three are working great and the fourth I am not getting any response. These two strings work perfect in a ...
user avatar
1 vote
1 answer
47 views

I am trying to add a countdown to my Arduino code but it does 0 days, 04:09:36 instead of starting at 7 days

The code I use probably has a math problem since an Arduino can only count a 16 bit integer. This problem is with the WeekDelay() function. The project is for an Aerogarden. It pumps water into the ...
user avatar
1 vote
1 answer
58 views

Stepper motor with microstep driver

In my project I have to control a stepper motor using arduino and microstep driver, can I control the motor so that it can move 90 degrees then stop for like a second and then move again and repeat ...
user avatar
-1 votes
1 answer
120 views

I have been having a lot of trouble adding a countdown to a piece of code [closed]

This is the code. The /// are where I added the countdown. Unfortunately the countdown only goes down 9 seconds. What I want it to do is go down the full 24 hours. I have been trying to fix this error ...
user avatar
2 votes
1 answer
51 views

"Simple" code...but what have I done wrong? [closed]

This code compiles without problem, but doesn't work at all... The switch does not set the LED low and the while loop doesn't work, plus the serial print doesn't print.... Until I put the while loop ...
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
0 votes
1 answer
31 views

how to put whitespace in long Serial println() input [closed]

I have this long, Serial.println() that is in quotes, on multiple lines. Arduino IDE warns: "Missing terminating character". I am certain there is a way to break the lines up, while having ...
user avatar
  • 838
1 vote
0 answers
39 views

My port is grayed out?

Hello I have a question on why my port is grayed out when I go to upload? I’ve watched so many YouTube videos on what’s the problem and have been trying to do everything but just nothing seems to work!...
user avatar
1 vote
0 answers
31 views

Combining the code of MAX30100 and DS-18B20 [duplicate]

sorry to ask this but I am very very new to Arduino. My project aims to collect the skin temperature by 18B20 and the heart rate & SPO2 level by MAX30100. I have tested the codes for the ...
user avatar
  • 11
-1 votes
1 answer
36 views

'for loop' seems to change the execution of pow()

The first time, pow() works. But inside of a 'for loop', or again afterwards, it doesn't behave !? (I'm using a Chinese Pro Mini with Arduino 1.8.16) EDIT To clarify what I am asking, my question is:...
user avatar
  • 21
0 votes
1 answer
53 views

Optimised random alphanumeric string generator

I'm trying to build arduino nonce generator, but the only thing I found is this question on arduino forum but I can't find out how to make it work for me. I checked and Serial.available() is always 0 ...
user avatar
  • 305
1 vote
1 answer
66 views

How to change variable/sketch through a GUI

Over the past few months, I've been working on a wearable computer mouse using an Arduino and a 9-dof sensor. Most of the sketch is complete, and works as expected. Recently, I started investigating ...
user avatar
0 votes
1 answer
376 views

DHT22 sensor reading code interpretes negative values weirdly (Common problem)

The following code reads the DHT22 temperature and humidity values, assuming the pin value as the sensor's host pin. When the temperature drops below 0 °C, this code returns inadequate values in the ...
user avatar
  • 153
1 vote
0 answers
67 views

RTClib.h problem

In Library Manager RTClib and DS3231 work somehow with older versions. RTC time can picked only once and then it give bullshit. Using newest versions screen is empty. In picture first time is right, ...
user avatar
2 votes
1 answer
119 views

Is there something that I need to do to make the code from this answer compile?

I tried to compile the following code (using Arduino 1.8.16 with an esp8266-12) extern volatile unsigned long timer0_millis; unsigned long new_value = 0; void setup(){ //Setup stuff } void loop(){ ...
user avatar
  • 21
-1 votes
1 answer
39 views

Cannot change pointer for port in main loop

I am testing on an Arduino UNO. I want to use timer1 and interrupts to create various LED patterns. The LEDs may span multiple ports i.e PORTB and PORTD. I want to use a "volatile uint8_t*" ...
user avatar
1 vote
0 answers
65 views

Millis() based timer program for 24x7 usage in Arduino [duplicate]

I have made an irrigation system using Arduino. Timer program is based on comparing the previous Millis() and current Millis(). I want to know the chance for error when the currentMillis() overflows ...
user avatar
1 vote
0 answers
43 views

1.) How do I delay a servo motor from turning in a loop? 2.) How do I make a servo motor's change in position dependent on temperature?

I'm super new to the c++ programming world (currently taking the class now) and I'm in need of some assistance with some coding that's way beyond my knowledge at the moment. I have to write a code for ...
user avatar
0 votes
1 answer
31 views

Trying to program a Led Counter Want a Led to flash every 5 minutes however it flashes twice every second (Noob) [closed]

Heres the code i've Wrote i feel like the issue lies in how ive used the if statement int ledPinS = 13; //Classifies pin 13 as Connected to an LED //Flashes every second int ledPinM = ...
user avatar
-1 votes
1 answer
92 views

What is the simplest way to emulate the original gameboy's cpu using Arduino?

My initial question assumes it is possible to emulate the original GameBoy system using an Arduino board. Additional information in non-technical terms: I am looking to create an Arduino based device ...
user avatar
0 votes
1 answer
107 views

Problem Using pins A4 and A5 for input and output I2C

Hardare used: Arduino nano ( old Bootloader ) Oled Monochrome Display ( 4 pins, 128 x 32 ) MPU 6050 Both display and MPU use A4 and A5 as I2C communication protocol, They interfere, as the MPU is used ...
user avatar
1 vote
0 answers
260 views

Expected signature for ATmega328P is 1E 95 0F; I can not burn bootloader on my arduino Uno

well... the problem starts from the time that I accidentally touched the crystal on my arduino and all of a sudden everything messed up; the leds on arduino turned on and off while being touched, and ...
user avatar
  • 11
-1 votes
1 answer
59 views

Arduino Sleep to conserve battery - How to intergrade it to existing sketch - HELP pls

My sketch below is simply using a touch sensor to activate a servo motor to go from from initial position 0 to 180 then back to 0. then I want the Adruino NANO to go to sleep to conserve some battery ...
user avatar
1 vote
0 answers
49 views

I2C 16x2 LCD - Will Initialize (sometimes) - Holds Up The Code

Basically I have a keypad, that when a certain code is entered, it will write either "Wrong code" or "Good code" on the LCD. At the same time a timer will count down until 0 is ...
user avatar
2 votes
4 answers
87 views

How or why is the Arduino keeping a LED on when the input putton is no longer pressed?

I'm trying to follow lesson 6 of the Adafruit Arduino lessons on digital inputs found here. I have the same code and the board setup the exact same and the code it is working exactly as it should. I ...
user avatar
  • 31
2 votes
1 answer
153 views

Using MAX30100 SpO2 value to turn on LED

max30100 i2c sensor gives heartrate and spo2 reading in serial and also can show values in lcd display. I want to show it's indication via LED. If SpO2 value <94 , it will turn on Red led in ...
user avatar
  • 23
-1 votes
2 answers
87 views

Why won't this work as a delay?

I'll start off by saying I'm very very new to coding, so please bare with me. I'm doing an assignment where the task is to create a traffic light system, but blocking delays aren't allowed. I have ...
user avatar
  • 1
9 votes
4 answers
2k views

How do you handle sensor drift?

I have a pair of potentiometers, on the Arduino, the output seems to drift, by one or 2 digits, back and forth. I would prefer they were read as one fixed value, without variation when their knobs are ...
user avatar
  • 838
1 vote
2 answers
218 views

how to config the Arduino ADC'S input on A0 instead of use default?

I am try to build this AC-DC meter, the code original used default A3 as input, how can change the input on A0? the link: https://simple-circuit.com/arduino-autoranging-ac-dc-voltmeter-with-trms/ ...
user avatar
  • 11
2 votes
2 answers
114 views

how can I accurately recieve potentiometer values over the USB port?

I want to read the analog values of my ardunio uno into a separate c++ program. On the Arduino I have a serial port initialized for 9600 baud: int sensorPin = A0; // select the input pin for the ...
user avatar
  • 838
1 vote
1 answer
109 views

Can I get the hex file from an Arduino without the .ino code [duplicate]

I have a CNC router table that came into my local makerspace. The board looks like it has some standard parts, but also has some parts I don't recognize. At the heart of it is an Arduino Uno. I would ...
user avatar
  • 838

1
2 3 4 5
32