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
2 answers
28 views

Multiply char with float

I have a value for led brightness that is stored as an unsigned char (0-255) unsigned char* colors[3]; colors[0] = 255; colors[1] = 0; colors[2] = 0; I want to multiply a brightness percentage to ...
user avatar
  • 113
1 vote
1 answer
36 views

Mouse.move: how do I move the mouse to the center of a screen?

I have a program operating in full screen mode. I would like to move the mouse to the center of the screen. Is this something I can do with the functionality of Mouse.h? https://www.arduino.cc/...
user avatar
  • 858
0 votes
0 answers
36 views

Arduino Bootloader hex file loading

Today I come up with a question kinda disturbing me as I need a solution for it. I usually load the bootloader to atmega328 by using Arduino. In order to do that I first need to program Arduino as isp ...
user avatar
  • 51
-2 votes
1 answer
43 views

How to set number in address field?

I want to build structure of record. The problem is that I can't build the address field correctly. Can any one help me? P.s: the address[16:2] is start from bit 61 to bit 47 so please you can't say ...
user avatar
0 votes
1 answer
64 views

L LED keeps staying on

I am trying to get the Arduino to reboot my PC when it is off. Using the front panel header on the PC, I connected the power switch and PLED directly to the Arduino Uno as the header only outputs 5 V. ...
user avatar
  • 11
-1 votes
0 answers
65 views

Arduino sketch shows error on first line of every program

I just got a new Arduino Micro with headers and I have connected it directly to a 16x2 LCD. While I was uploading a test LCD program I was given an error where the first line of my program was ...
user avatar
0 votes
1 answer
49 views

Using pyFirmata with a 360° servo; how do I stop it?

I am testing out pyFirmata. I have a 360° servo, and know how to change its direction, but I dont't know how to stop it. What command, like servo.write(), would work to make it stop moving until ...
user avatar
1 vote
1 answer
44 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
45 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
197 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
26 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
2 votes
1 answer
482 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
  • 858
1 vote
1 answer
47 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
48 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
56 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
319 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
107 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
63 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
-1 votes
1 answer
223 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
102 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
76 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
289 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
30 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
2 answers
42 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
56 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
67 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
121 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
52 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
53 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
35 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
  • 858
2 votes
0 answers
46 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
37 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
99 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
74 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
426 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
73 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
128 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
42 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
67 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
48 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
32 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
95 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
136 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
334 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
64 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
52 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
89 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
176 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
90 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

1
2 3 4 5
32