Questions tagged [code-review]
Code review is systematic examination of your Arduino sketch. It is intended to find and fix mistakes overlooked in the initial development phase, improving both the overall quality of software and the developers' skills.
253 questions
2
votes
1
answer
788
views
Using a keypad to play an audio file on Arduino Mega and Adafruit VS1053?
I am trying to use a keypad to trigger an audio file using an Arduino Mega and Adafruit VS1053 Music Maker. I have gotten the music files to play independently, and when the correct number is entered ...
1
vote
1
answer
113
views
Arduino Mega 2560 + DRV8871: Motor Not Moving with PWM Control
I'm using an Arduino Mega 2560 to control a DRV8871 motor driver connected to a DC brushed motor. The setup includes:
Three buttons: UP, DOWN, and FAST
One limit switch input, where the upper and ...
0
votes
1
answer
106
views
Keypad library isn't working or I am wrong somewhere [closed]
I am using PICSimLab to simulate a keypad. The configuration of the keypad is as shown in the picture:
and the code is:
#include <LiquidCrystal.h>
#include <Key.h>
#include <Keypad.h&...
1
vote
2
answers
2k
views
HX711 Ridiculous speeds
I'm using a SparkFun HX711 board and an Adafruit AdaLogger (M0) Featherboard. I have cut the trace on the back of the HX711 to get a faster data rate (should be about 80 sps). I did this by reviewing ...
1
vote
1
answer
150
views
Sounds are being played at the same time
I'm making a school project that allows plants to 'talk'. As in when the plant is in an un-ideal environment (low or high soil moisture, not ideal temperature or humidity and not enough light). I have ...
3
votes
1
answer
784
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 ...
-2
votes
2
answers
92
views
how to convert a line of code for arduino to receive a value
im sending the value 1500 from another MCU with
fdserial_txChar(transmit, send >> 7); // send Higher 7 bits
fdserial_txChar(transmit, send & 0x7F); // send Lower 7 bits
and was ...
-2
votes
1
answer
177
views
Can someone check my code? My Arduino isn't doing a consistent count cycle
I'm wondering if someone could have a look at my code and let me know if there's something wrong with it. I had the code done for me a while back and did a quick test and it seemed to work. I have now ...
1
vote
1
answer
402
views
DHT11 temperature and humidity sensor Code
I’ve got a question about this code I’ve attached please- would it be correct to read it like this:
After defining the variable temperature and humidity and assigning measurement_timestamp to millis(),...
2
votes
1
answer
147
views
Ramping servo motor taking longer than calculated
I'm learning how to code a "BOE Shield bot" with a partner at my university (first year). To clarify for those that do not know: a BOE Shield bot is a small robot equipped with 2 servo ...
4
votes
2
answers
2k
views
How to move a servo quickly and without delay function
Im trying to move a servo from one place to another while using the typical for loop you find in the servo's library example:
int lightON = 180;
int lightOFF = 90;
for (pos1 = lightOFF; pos1 <= ...
1
vote
0
answers
286
views
Code question: LCD keypad Shield. How do I define the buttons?
I am trying to adapt a alarm clock sketch that used external buttons, but I would like to utilize a LCD Keypad Shield. The data sheet says all the buttons are on pin A0, so every button is "set ...
-1
votes
1
answer
192
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 ...
2
votes
2
answers
152
views
How to get 2 loop functions to cooperate?
I have a OLED SSD1306 & DS3231 RTC, 2 buttons to set the time & date. My project is to display a scrolling text at the top of the OLED, the RTC time in the middle, the day & date on the ...
-1
votes
1
answer
126
views
Why are the PWM variables in this RC code snippet handled this way? What are the magic numbers?
tcommand=(pwm_value-480.0)/8.22;
flapmag=(pwm_value-880)/41.0+10;
In this piece of code used in arduino radio control aircraft, I don't understand why PWM value is subtracted and divided like this. ...
3
votes
2
answers
306
views
How to move a servo with a function
Im currently moving a servo from one side to another by using the typical for loop like this:
int lightON = 180;
int lightOFF = 90;
if (buttonState == HIGH) {
digitalWrite(LED, HIGH);
for (pos1 =...
1
vote
1
answer
635
views
Monitoring multi analog ports with ACS712 current sensors
Making a Auto Blast Gate for dust collection in my wood shop. Arduino Nano using ACS712's to detect when tool is in use. Using DRV8825 to drive a single Stepper motor that will spin a disk to line up ...
-1
votes
1
answer
159
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 ...
1
vote
4
answers
4k
views
What are examples of large Arduino code bases and how are they organized?
I'd like to find out:
how big can an Arduino project get, is there some limit?
are there examples of large open source code bases? I did some research but find only example projects with single .ino ...
1
vote
0
answers
39
views
servos act strangely instead of stopping/starting
I am trying to make it so that my robot rolls straight when pin 8 is high and stop when pin 8 is low, the 2 servos is constant rotation servos. instead the servos spin when the wire touches it pin ...
1
vote
1
answer
1k
views
ESP32 preferences. One error returned, all others work. SOLVED
I am using the Preferences.h library in my Arduino code. I initialize some values. I save them with the preference library. I then modify all the values, then read back the original saved values.
All ...
0
votes
1
answer
304
views
Two-Wire Interface (TWI) Frequency and SMBus Compatibility
Have I understood the ATmega328P datasheet correctly regarding the TWI clock frequency?
From §21.5.2 Bit Rate Generator Unit, the TWI clock frequency is calculated as follows:
Then solving for TWBR:
...
1
vote
1
answer
241
views
Seeburg Consolette Jukebox
I am working on a Seeburg Jukebox wall unit, I have it playing one track at a time form a SD card no problem. But what I need help with being new to programming is:
1. The code is long because it can ...
5
votes
3
answers
2k
views
How do I make another action repeat inside a loop?
So, I've just started programming Arduino (and also in general), so I'm doing basic things, like switching on and off LED's.
I've made them light in a sequence and then turning them off (in the same ...
0
votes
1
answer
714
views
Countdown sometime stop
I've made a game with 3 countdowns and 1 global countdown.
When we start, the global one, go from 45:00 to 00:00.
The 1 go from 15:00 to 00:00 and if it reach 00:00:
The 2 start and go from 15:00 to ...