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
0 answers
22 views

Code logic to measure values stored in buffer and created nested array

I am having a difficult time creating some logic in my code. I have a potentiometer connected to an ESP32 to simulate a load cell and a range sensor. The value for the force is between 0 and 400 ...
-1 votes
0 answers
18 views

Help with Linear Actuator problem 12V

I'm new to the community, I would like your advice to help me with this project. Thank you in advance! I want to power these two 12V Linear Actuators using this LiPo Battery which I bought. And an ...
3 votes
2 answers
2k views

DS18B20 with only OneWire library

Peter Scargill found a way to use a DS18B20 temperature sensor only using the OneWire library, and it's amazing how blazing fast it is! (It's an old article from 2013.) #include <OneWire.h> ...
0 votes
0 answers
43 views

error code on the last line of my sketch

#include <LiquidCrystal.h> #include <DS3231.h> #include <DS3231.h>//Memanggil RTC3231 Library #include <Wire.h> // i2C Conection Library #include <LiquidCrystal.h> //...
0 votes
5 answers
16k views

Guide to code for multitasking and non blocking timers

I'm beginning to do kind of sophisticated things (well.. for my entry level skill) and I have to control a display with 3 LED and 4/5 types of events and status. I'm using the BlinkWithoutDelay ...
0 votes
0 answers
40 views

Moving servos with IR sensors

This is what I have so far: The plan: I have two IR sensors I have two servos What I would like to achieve is as follows: Enter IR sensor 1 and leave, servo 1 will turn to 180 Enter and leave IR ...
0 votes
0 answers
98 views

How do you cast a comma separated list of numbers into an array? [duplicate]

In my case, in the most simplified form, I am trying to convert "1,2,3,4,5,6,7,8" to an array which should look something like this: {1,2,3,4,5,6,7,8}. This is the main part I am struggling ...
0 votes
2 answers
1k views

DHT22 sensor reading code interprets negative values weirdly

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 ...
1 vote
2 answers
147 views

LoRa to MQTT sensor data can't be read

I'm trying to transfer data from a temperature sensor that is located outside my WiFi area. I have chosen LoRa technology between an ESP32 equipped with an SX1278 and a TTGO Lilygo LoRa. So far ...
1 vote
1 answer
39 views

Help with program upload problem

I'm going to upload some code to my LeArm using an Arduino board. I connected the RX and TX pins of the LeArm to the Arduino, but I got an error message when I tried to upload the code. I'm not sure ...
0 votes
0 answers
21 views

How to integrate two codes like fingerprint scanner and RFID for door lock system [duplicate]

#include <Adafruit_Fingerprint.h> SoftwareSerial mySerial(2, 3); Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial); uint8_t id; void setup() { Serial.begin(9600); while (!...
0 votes
0 answers
47 views

IRremote command stops my whole Arduino

#include <Adafruit_SSD1306.h> #include <Adafruit_GFX.h> #include <Arduino.h> #include <IRremote.h> #define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin) #...
-1 votes
1 answer
114 views

SPI with DMA in a Arduino Due

I have a project where I need to store data (~16 Mo) on a memory and be able to fetch the data fast (<36000 bits/s) with DMA because I have other signals to take care of. Currently I use an SD card ...
0 votes
1 answer
47 views

ATtiny25 - assembly - BOD disable for sleep mode - error [closed]

If I understood the AVR instruction manual correctly, the ATtiny 25 can disable the BODlevel2 fuse by software, but when compiling with Studio 7 (version 7.0.132), I get the error "Undefined ...
1 vote
1 answer
3k views

Variable declared inside void setup() is forgotten in void loop()

If I declare a variable 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() { ...
3 votes
1 answer
316 views

TFMini Sensors with Arduino

I have three TFMini sensors I need all of them to detect. I only got one to work , pins 4,5 . My info in coding is basic . I really appreciate your help . Thanks in advance. I think the problem is ...
0 votes
1 answer
277 views

Function of rxAlign parameter in the PCD_ReadRegister function in MFRC522 Library

I'm trying to port the MFRC522 Arduino library (from GitHub) to the ARM MCUs. My problem is with the PCD_ReadRegister function: /** * Reads a number of bytes from the specified register in the ...
4 votes
4 answers
3k 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 (...
62 votes
7 answers
108k views

Is using malloc() and free() a really bad idea on Arduino?

The use of malloc() and free() seems pretty rare in the Arduino world. It is used in pure AVR C much more often, but still with caution. Is it a really bad idea to use malloc() and free() with ...
3 votes
1 answer
221 views

Arduino hangs / freezes - can't figure out why

I am building a remote controlled boat. My remote project freezes after an arbitrary amount of time. The serial stops output, the OLED doesn't update anymore and instructions are not send / received ...
-1 votes
2 answers
165 views

I need help for applying a logic to this code

Here's the code: int softStart = A0; int enable = A1; int powerBTN = A2, powerState = HIGH, lastPowerState = HIGH; unsigned long lastDebounceTime = 0; unsigned long debounceDelay = 25; unsigned long ...
2 votes
1 answer
153 views

Read values from a txt file on an SD card

I'm trying to read a text file (has numeric values) from SD card. The values in the file like this 87 512 255 I need to read 87 in ch1 and 512 in ch2 and 255 in ch3. Why did I get on 'SKIP_NONE' '...
3 votes
1 answer
1k 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 ...
1 vote
1 answer
84 views

Make two LEDs fade in and out with with different PWM values

I have two UV leds, one Vf 3.3V @ 150 mA and the second one Vf 5V @ 150 mA. I need a circuit to make them fade in and out alternatively, i.e., as one goes dimmer the other goes brighter and vice versa....
3 votes
2 answers
2k views

is #ifdef __SD_H__ considered a bad practice?

Say I'm working on a library^1 to which I want to add support for SD.h^2 but knowing for a fact that many microcotrollers don't support SD.h (therefore they result in compilation errors [eg. Attiny85])...
4 votes
2 answers
313 views

"if" condition problem / question

I'm new to Arduino and my question is rather theoretical. I have an Arduino Nano board (Atmega168 processor), a button, a display. I have written a button handler that does not stop code execution. My ...
1 vote
0 answers
41 views

MKR GPS shield inconsistent GPS connection/data printing...library issue?

I have been using a MKR WiFi 1010 board with GPS shield for a very long time (year+) and have not been able to solve my problems with the GPS data dropping out. The setup for my field application is a ...
0 votes
0 answers
80 views

Unable to program with AVR ISP mkII under Linux

I just got an AVR ASP mkII external programmer and I am unsuccessfully trying to program my arduino with it. All the settings in the IDE are correct. This is the error message that I am getting: ...
0 votes
1 answer
116 views

Problem with Bing generated code for automated chicken coop door

Glenn from Sweden here. I was wondering if some kind soul could help me out here. My partner bought a cheap chinese knock-off automatic chicken coop door that operates based on sunlight. Link to the ...
0 votes
1 answer
1k 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 vote
0 answers
241 views

How can I program an Arduino Pro Mini with an ESP8266-01 connected to its TX and RX?

I am working on a project that uses an Arduino Pro Mini to gather information from various sensor. Once the readings are taken I turn on an ESP-01 from a separate dedicated 3.3v power supply. The ESP-...
8 votes
6 answers
21k views

How to loop over analog pins?

I want to do something along the lines of for (int i = 0; i < 4; i++) { analogRead(i); } Which appears to work, but the following does not: for (int i = 0; i < 4; i++) { pinMode(i, INPUT);...
-1 votes
1 answer
241 views

convert string representing a binary number to binary

I have a serial input "1111111" and I would like to convert this to a binary B1111111 that I can send to a led matrix. I tried to search, but, all the results were misleading, led to full ...
1 vote
1 answer
136 views

ArduinoJson reading `null` from Serial

I have a setup that reads from serial when I sense that there is something to be read (and always assume that what is sent to the arduino is valid json): void setup(){ Serial.begin(9600); ...
1 vote
1 answer
209 views

How to add one JsonDocument to another in ArduinoJson

I'm utilizing this json library: https://arduinojson.org/ I am attempting to write a function that creates a response object, and wraps an already built json document: void sendResponse( ...
3 votes
1 answer
533 views

led chaser fill color effect

Please help. I am learning a lot about Arduino. Most all in lightning. I am a newbie. I play with nano and LED ws2812 and use fastled library. What ask is to make effect like fill effect. For ...
2 votes
0 answers
137 views

Arduino NANO RF reciever and Digispark Attiny 85 transmitter issues

I am trying to send RF signal from Digispark Attiny 85 (this one) and receive the signal with Arduino NANO V3.0 ATmega328 (this one). Transmitter and receiver are STX882 and SRX882 (these). Library ...
3 votes
1 answer
124 views

How do I set the DHCP pool for an ESP-WIFI-MESH? [closed]

I'm building a mesh with ESP32 dev kits (ESP32-DevKitC V4) using the ESP-IDF VS Code extension and the ip_internal_network example project. The code for the example, common project components, and the ...
0 votes
0 answers
37 views

Salvaging Arduino board from Google ADK 2012

I found an old Google ADK 2012 in my closet and remembered it came with a Arduino board (?), an ARM 32-bit Cortex M3 micro-processor available at the time (possibly the DUE). The ADK 2012 design files ...
1 vote
0 answers
174 views

How to use multiple PN532 over i2c bus(es) and SPI?

I am working on a project that involves 3 PN532_modules to an ESP32, which sends the Tag_ID over BLE. Plan A was to use One module on i2c_1, second on I2C_2 and third over SPI. The SPI one works as ...
1 vote
1 answer
106 views

Programming barebones ATMega328 with external programmer and no bootloader

I have created a circuit with a barebones ATMega328. I also have an external programmer (Sparkfun's Pocket AVR Programmer)... Now I want to program a particular sketch... When uploading a sketch, do i ...
0 votes
2 answers
125 views

How much readable text can fit inside an ATTINY85? Feasibility of scrolling a booklet on a 0.91-inch OLED display

I'm a total beginner, so I've been talking with Chatgpt regarding the capabilities of the Attiny85 microcontroller. But the AI would hallucinate a lot and give only partially right answers (because it ...
2 votes
1 answer
71 views

Functions delaying gesture sensor recognition

I am working on a simple little robot to cure my boredom and all it has is a 64 x 32 OLED for the eyes, and a PAJ7620 Gesture recognition sensor with a Seeeduino Xiao as the main board. Basically, ...
2 votes
1 answer
71 views

AMIS30543 | DataSheet Understanding CIRCULAR TRANSLATOR TABLE

I was reading the data sheet of AMIS-30543 stepper motor and I didn't understand fully what does this Circular Translator Table means, I have a couple of doubts What does Circular Translator table ...
3 votes
1 answer
355 views

Problem when coding 4x4 keypad's key detection (without library)

Part of my current assignment involves reading the input from a 4x4 keypad connected to an Arduino UNO. While this may be done easily using <Keypad.h>, the project is being done with Tinkercad's ...
3 votes
1 answer
242 views

How do I use a transmitter and receiver to send string messages conditionally to a receiver?

I'm working on a project to build a plant monitor that works from the outside with Arduino that picks up light and water values from it's environment then uses a nRF24L01 with an antenna and I've come ...
4 votes
0 answers
53 views

Can I use regular pins (Example: D2, A3, etc...) as serial (RX, TX)?

Python/Arduino Beginner here... I have a DFplayer I am trying to hook to my Arduino and I want to hook it up through the regular pins instead of the RX and TX pins, but I've not been able to find ...
2 votes
1 answer
88 views

Improving moving mouse loop to optimize speed

Code: #include <Mouse.h> #include <hiduniversal.h> #include "hidmouserptparser.h" #include <USBController.h> USBController controller; USB Usb; HIDUniversal Hid(&Usb); ...
1 vote
1 answer
300 views

RFID card read loop seems to stop

I successfully programmed an RFID card reader to switch lights on and off if any rfid card is presented. I have tested this and it works, with the lights continually switching on and off if any rfid ...
3 votes
0 answers
64 views

nano 33 BLE problems with reading RC signal

I'm using an Arduino Nano 33 BLE and a L293D motor driver to control a three-wheeled RC robot. The sketch I'm using worked fine with my Uno Rev3, but I've moved to the Nano for size/weight reasons, ...

1
2 3 4 5
34