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.
1,669
questions
-2
votes
0
answers
23
views
How can I detect faces using an esp32 cam module and control a relay? [closed]
I am using the example code of esp32 called "camera_webserver" to detect human faces and control a relay. But I can't do it no matter how hard I try.
Different online sources suggest that I ...
-1
votes
0
answers
28
views
Trying to Use both SPI 's on my STM32 Blue Pill neither one works
I am new to coding on STM type processors, Okay with Arduino though.
On my STM32f103C8t6 (blue pill), I have tried to use both SPI connection which are SPI1 and SPI2. I am using Arduino IDE 1.8.19 to ...
0
votes
0
answers
17
views
Sending data through LoRa with ESP32-E
I have an Esp32-E from Firebeetle and LoRa from SBComponents. On both of these devices there are RX and TX pins. I believe that LoRa pins are just an extension of pins found on the Firebeetle.
My ...
-1
votes
0
answers
20
views
Handling real time incoming data for model prediction on arduino
I am working on a real-time gesture recognition system using a tflite CNN model on an Adafruit nrf52840 sense. The inputs are a time series of accelerometer and gyroscope x, y, and z (104 samples), ...
1
vote
2
answers
115
views
Multiple threshold crossings trigger multiple LEDs - but only one at a time
I'm calculating the acceleration magnitude vector from an accelerometer inside a thick PU mat. When the mat is hit, depending on the value I obtain, only one of two LEDs, later more, shall light up ...
0
votes
1
answer
39
views
Arduino TFT Touch Screen Interface Only Returns One Button Option
I'm trying to create an arduino code that returns a value for the button that was pressed as the user choice. However, whichever button I press the only return is 2. Also, whenever pressing other ...
1
vote
0
answers
47
views
Code for a load cycler seems to be stuck
I am trying to make a battery load cycler to charge and discharge a battery repeatedly for a certain amount of cycles and here is my code:
bool in_charge_mode;
int cycles = 0;
float cutoffvoltage = 2....
1
vote
1
answer
65
views
Using WiFiServer in blocking mode
I am learning ESP32 network programming and I started by writing a simple telnet server. It uses a WiFiServer object to listen on port 23 and just log anything it receives to the serial monitor.
...
2
votes
0
answers
44
views
My code got my Nano ESP32 into a <500ms reboot loop
I have done a lot of reading and learning after previous help here and it has been great.
I have uploaded and tried many iterations of my code which all worked (Assuming my code was actually good) and ...
0
votes
1
answer
107
views
LED ring with different effects cycling
I need help for my little project. I don't know Arduino, so I used ChatGPT to write me the code. After a few hours of testing, I almost got what I need. The scheme is the following: LED ring, push ...
1
vote
1
answer
117
views
Need help with programing the LCD for my project
I am trying to make a digital dice for my project in school. I am having troubles with the programming, I don't really know how to write code and I am not a programmer.
I took inspiration from a post ...
0
votes
1
answer
135
views
Programmer vs target clock frequency
I have a 16u2 programming a 1284P for a custom board I am building. The 16u2 converts USB to USART for programming the 1284P, however the 16u2 has a maximum frequency of 16MHZ while the 1284P has a ...
-1
votes
1
answer
58
views
No new random number generated
I made a teddybaer with buttons, LEDs, and voice output for my son. There are some buttons with pictures of our family with LEDs behind. The adruino is connected to a DfPlayer mini.
After pressing a ...
1
vote
0
answers
38
views
Weird issue with wire.requestfrom() and MailClient.sendMail() on ESP32- rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
Update_2: No change after Update_1, same error. I still have to comment either email, I2C, or Temperature out, that the other two can work.
Update_1: I'm also using a DS18B20 with #include <...
2
votes
2
answers
439
views
Arduino Digispark ATtiny85 conditional logic not working
Expected Behavior:
I am attempting to use && or nested if statements to achieve the effect of two switches being required to close prior to an LED light (i.e., flip both switches), the LED ...
1
vote
3
answers
279
views
Serial.println printing just after the previous string in same line
I wrote serial.println in my code but the string was printed in same line on serial moniter.
#include <WiFi.h>//for connecting esp32 to a wifi
#include <TinyGPS++.h>//to obtain gps data ...
1
vote
1
answer
40
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 ...
0
votes
1
answer
56
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
votes
2
answers
174
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 ...
1
vote
1
answer
153
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
327
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
92
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
142
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
154
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 ...
2
votes
1
answer
226
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' '...
-1
votes
1
answer
502
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
219
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
482
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(
...
-1
votes
1
answer
305
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 ...
1
vote
0
answers
329
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
134
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 ...
2
votes
1
answer
80
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, ...
0
votes
2
answers
157
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
0
answers
191
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
203
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 ...
3
votes
1
answer
481
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 ...
4
votes
0
answers
61
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
155
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);
...
3
votes
0
answers
76
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
vote
2
answers
508
views
How do I turn on 3 LEDs in a repetitive sequence where all three LEDs would then turn OFF when the push button used is released?
Basically, how do I modify my code listed below to turn ON each of the three LEDs one at a time in a repetitive sequence while keeping the push-button pressed?
Red (3 sec),
Yellow (1 sec), and
Green (...
3
votes
1
answer
512
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 ...
1
vote
1
answer
602
views
How to drive two Stepper motors and use an Ultrasonic sensor together?
I am working on an autonomous robot using two 4-pin stepper motors, HC-SR04 ultrasonic sensor, 2 L298N motor drivers (one for each motor), and an Arduino Uno. My problem is that when I use the stepper ...
1
vote
1
answer
268
views
How to write single binary code to output pin
I am relatively new to arduino and coding in general and im just looking for a code to write a single string of binary code e.g.; "01000111101"
To a specified output pin instead of copying ...
-1
votes
1
answer
216
views
Arduino-project with color sensor and rgb-led
I want to use a color sensor for my Arduino project with Arduino Uno to detect the colors red, green, blue, orange, yellow purple of leaves of paper and then light my RGB led in those colors. I have ...
1
vote
0
answers
108
views
how to config size USB mass storage arduino nano ble 33?
I see that they arduino nano ble 33 support USB 2.0. Is there a way for us to create a USB mass storage of about 200kb for convenient storage of configuration files and history files?
I see example ...
1
vote
1
answer
462
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 ...
1
vote
0
answers
248
views
What is the most simple sketch to confirm the DAC works for audio on a speaker with it's own amplifier for an ESP32?
I have a PC speaker with it's owner power supply (no amplifier needed). It just uses a standard AUX jack.
Most examples sketches use an amplifier like the MAX98357A. I have explored some libraries too,...
1
vote
1
answer
48
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 ...
1
vote
0
answers
351
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-...