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
1
vote
1
answer
112
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 ...
2
votes
1
answer
115
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
208
views
Code review for timer using RTC and OLED screen
I am building a small art project to display my current age with an accuracy of 1/100th of a second. I am using a XIAO SAMD21, a DS3231 RTC, and a 128x32 OLED screen. Here is what it looks like right ...
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
783
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 ...
1
vote
1
answer
401
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(),...
0
votes
1
answer
166
views
Single Method for 2 Ultrasonic Sensor is not working as expected
So I have created a method to read and return Ultrasonic Sensor Data. I have 2 Ultrasonic Sensors.
Below is my code.
// Ultrasonic Pins
#define T1 2
&...
-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 ...
1
vote
1
answer
144
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 ...
-1
votes
1
answer
158
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
votes
1
answer
60
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:...
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 ...
1
vote
2
answers
764
views
NodeMCU wont connect to Blynk
My NodeMCU wont connect to Blynk with my code but works fine with example code and same auth token and WiFi info. Cant figure out why its not working. Must be something in my code interfering with it (...
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
vote
2
answers
434
views
Arduino code not working properly (Please Help)
I am having some trouble getting my board to perform the function I want it to perform. This is a project I have due in a few days, and I have hit a wall I just can't seem to get past. Now, I will say ...
1
vote
2
answers
332
views
Adding another flow sensor to sketch
Adding another flow sensor to sketch
I have a water flow sketch I use for my freshwater consumption. I would like to adapt it to use for diesel fuel consumption. The difference is with a diesel ...
1
vote
1
answer
66
views
Explanation of code found online
i found following code online, to read the value of a touch sensor... i am having difficulties understanding how the 2 second timeout on the marked line works..
if ((touch_sensor_value (...
1
vote
0
answers
955
views
How to stop my 16*2 lcd blink?
Here I wrote code for my weighting scale measurement. In which I added an on/off switch for my LCD display. But in defined delay time my LCD is a blink and I do not want it. I want my LCD switch on/...
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 ...
1
vote
0
answers
2k
views
Wemos d1 mini code not uploading
I have a wemos d1 mini. I uploaded a code in wemos d1 mini and after that my wemos mini not working. I tried to upload another code in it even the led blink sketch and even a blank sketch but whenever ...
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
1
answer
264
views
Turning on and off two set of LEDs with two tactile buttons
I have two sets of 4 LEDs.
Set A (Led1 Led2, Led3, Led4)
Set B (Led5 Led6, Led7, Led8)
Both sets have its own tactile button:
Tactile A,
Tactile B,
Tactile A, turning on the LEDs set A and tactile B ...
1
vote
0
answers
286
views
Why is my buzzer always on?
I wanted to make a buzzer go off when the distance measured by the ultrasonic sensor becomes more than 100cm. The things used in this project are a 4x4 keypad, an hc-sr04 ultrasonic sensor, and a ...
1
vote
0
answers
89
views
Can someone check my schematic and code? My Led is not turning on
Led1 is on the left Led2 is on the right The code is making LED1 blink every second but it should also turn on Led2 so that whenever I press the push button it should turn off Led2. But Led2 isn't ...