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.

Filter by
Sorted by
Tagged with
-1
votes
1answer
66 views

Refactoring bad design?

Could someone help me how to refactor old very complex code ? Original used just setup and everything else was in single ISR. But as it was bigger and bigger, code is quite slow and quite random ...
0
votes
1answer
45 views

A confusing condition statements

I am working on a project in making a timer socket using Arduino and a current sensor. For the code I decided to modify a code that was meant to be a kitchen timer. In that code I found a statement ...
0
votes
0answers
23 views

How do I have this audio and LED activate ONLY when a button is held using an Arduino?

I have this code that I am using to play a sound effect where I used a program called wav2c to convert a .wav file to number values that I put into a header file that I use in the code to generate the ...
2
votes
1answer
49 views

Why won't this code play a converted wav2c header file through an Arduino to my speaker?

I used this converter wav2c to convert a .wav file to a C that I can put in a header file. I was able to put converted audio into the h file but the program where I reference it does not seem to be ...
1
vote
3answers
210 views

Variable declaration inside main loop

In the past I declared variables inside the main loop which worked just fine. In a new project I did the same: void loop(void) { uint8_t counter; .... if (buttonPress) counter = 0;...
0
votes
0answers
34 views

Garbage Characters Being Sent from HC-05

I have a contraption that uses a HC-05 Bluetooth module and sends info to a processing program which controls the contraption. The processing program is a follows (from a video by How To Mechatronics,...
0
votes
0answers
36 views

Sending a union from Arduino via serial communication and parsing it in python

I want to send a union from Arduino to a python script running on a pc, and I want to parse the received union. I have read lots of topics online but I am stuck on how to do it in the most efficient ...
0
votes
1answer
35 views

RGB LED circuit problem

I have written the following code for RGB LED:- const int RED =11; const int GREEN = 10; const int BLUE= 9; void setup() { pinMode(RED,OUTPUT); pinMode(GREEN,OUTPUT); pinMode(BLUE,OUTPUT); } ...
1
vote
1answer
34 views

Code for two bulb fading alternatively

I have written this code const int A = 3; const int B = 5; void setup() { pinMode(A, OUTPUT); pinMode(B, OUTPUT); } void loop() { for(int i=1;i<=255;i++) { int j =255-i; ...
0
votes
1answer
25 views

Arduino Uno - Variables randomly changing

So I have a circuit for a timer (I don't think it is the problem) Sorry for it being a little messy. And I have this code (probably the problem): // LiquidCrystal - Version: Latest #include <...
1
vote
1answer
45 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 ...
2
votes
2answers
72 views

arduino LCD help

I am trying to create smart clock with alarm using an Arduino Uno. My problem is when I set the alarm, I can't set the alarm again. Every time I must power off my Arduino and then power on in order ...
0
votes
1answer
49 views

can someone check my code, my Arduino isn't doing a consistent count cycle

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 ...
0
votes
1answer
42 views

connection of led with dht and code combination

Hi again? I saw my last question did not come out well, so let me rephrase it. Ideally, my project is composed of 3 sensors: 2 dht-22 sensors and an mq-7 sensor. For the dht22 sensors, I am using ...
0
votes
1answer
58 views

How to Simulate and Tune a PID

I've been trying to simulate a PID using Brett Beauregard's PID library in order to understand it better. Here is my code. #include <PID_v1.h> const unsigned int numReadings = 500; double ...
0
votes
3answers
55 views

Not able to split string into 2 char

I am trying to split an incoming string into 2 integer values since I have to control 2 dc motors with it. The processor is node MCU and I get following error:- Com Port Reading:- WiFi connected ...
0
votes
0answers
45 views

Analog pins giving off the same value

So recently I made code that used two custom sensors that are connected to the analog pin A0 & A5. Schematic can be seen here (http://inmoov.fr/test-your-finger-sensor/). const int ono = A0; ...
0
votes
3answers
109 views

delay() not working inside loop() block

Edited and attached code here. This section didn't execute. The delay(15000); doesn't execute, I mean the sketch didn't execute this line no matter where to put it. // include the SPI library: ...
1
vote
0answers
42 views

Help with code for changing motor speed depending on MPU6050 angles read

I have been trying to create code where my MPU6050 is constantly reading the angle it is at and based on that angle, increase or decrease the motor speed. For example the motor will be off when the ...
0
votes
1answer
38 views

Code causing Servo motor not to work!

My sketch is compiling and loading, but when the program runs, the Servo motor does not work. The buttons work, the LED light works, Piezo buzzer plays the melody, the Stepper motor works but not ...
0
votes
1answer
62 views

Proper use of the tone() function within the loop () function [duplicate]

I am trying to have my sketch run a short series of tones (melody) through a Piezo buzzer after a selection is made by the user. I am getting a compilation error with my use of the tone function in ...
-2
votes
1answer
67 views

Arduino Code 'Bug'

I'm sharing my code.. The problem I am facing is that the code performs all the functions that are to be called except showing the MAX30100 (for heart rate) readings. I have tried this code using ...
0
votes
2answers
196 views

Combining 2 sensors in one code with 1 push button

I am trying to create a circuit with one tactile pushbutton, and LCD and two sensors: 1) temperature, and 2) pulse sensor. When the circuit is on, the LCD initially shows the reading from the temp ...
1
vote
1answer
302 views

Why is dtostrf() not working for this one value?

I'm building a weather station using an ESP32 and BME280. I'm feeding the data via MQTT and Python into a database that is then used to make a nice dashboard for the data. The MQTT message needs to ...
0
votes
0answers
177 views

Problem “Didn't find PN53x board” Arduino NFC Card Reader

i am using the elechouse PN532 RFID Module with an Wemos D1 mini in the Arduino IDE. I use the ISO1443a_uid example from the elechouse library. All works fine if i plug the USB Cable into the wemos ...
0
votes
0answers
225 views

Nested “switch” statements menu

I know that menus were discussed perhaps a thousand times here and everywhere. But using a ready solution is not something that I'm looking for because I know I won't learn the concept if I use them. ...
0
votes
1answer
70 views

Am I able to set up a code where I can have two ways of turning something on?

I am pretty new to Arduino. I've created a code with the help of many YouTube tutorials to control a servo with a button. I decided it has gotten a little un-exciting so I've been trying to add a ...
1
vote
1answer
74 views

New code results in audio noise

I am working on a circuit that can record audio to an SD when a switch is HIGH and stop recording when the switch is LOW. I am using the TMRpcm library. I previously had an issue solved on these two ...
0
votes
0answers
146 views

Arduino TFT LCD buttons reappear after fillScreen(BLACK);

I am very new to TFT screens and I am developing some code to display on a little information board, however I have come across an issue. Once I call tft.fillScreen(BLACK);, it writes testing but ...
0
votes
1answer
124 views

Ultrasonic sensor showing weird reading

When i run a test code in Newping library for ultrasonic sensor SR04 then in works properly but when i run the actual code for obstacle avoiding robot then it shows 0 cm everytime. This means that ...
-1
votes
1answer
135 views

how to code LED turning signals on smart car [closed]

this question is regarding how to add turn led signals on arduino powered smart car. I have 4 leds to give turn indications on my smart car(line follower, obstacle avoider, Bluetooth mobile controlled ...
-1
votes
1answer
169 views

esp8266 WiFi Cannot Connect to a PHP Server

I am using a magnetic float switch sensor to monitor water level in a tank. I am using a ESP8266 board. I am trying to send the data collected by it to a php page in a host called "weris.link". I've ...
1
vote
2answers
73 views

Arduino pow() making 9's

I am having a temporary lapse of judgement, or not understanding how the power method works, but when I put 10 to the power of a number, it is that value -1. So: 10*10 = 100 Then I would assume, 10^...
0
votes
1answer
25 views

Arduino loop over a function is always displaying 0 as final values

I trying to loop over a function in arduino to get values for 2000 times, and then divide it by 2000 to get an average offset: int16_t x_offset = 0; int16_t y_offset = 0; int16_t z_offset = 0; And ...
0
votes
1answer
117 views

Trying to use Tap Detection solution using ADXL345 with Arduino

I am using ADXL345 sensor connecting with Arduino via I2C interface, I am able to test the data at tri-axial axis but as there are some other features also, which I am going to try with Tap detection ...
0
votes
1answer
42 views

Compile Error for Arduino Sketch

I am attempting to increase the volume of a Max9744 20 watt amplifier from Adafruit using an Arduino sketch. I am just a very beginner and working with my grandson, this may be more than I am capable ...
1
vote
1answer
521 views

Rc car controller using the RC-switch library

simulate this circuit – Schematic created using CircuitLab (Newbie in arduino) Hi so i have a project which involves creating an rc car which uses the 433Mhz rf module and an arduino nano with ...
-2
votes
1answer
933 views

hx711 and load cell read out 0 for calibration

I'm using this tutorial from Sparkfun https://learn.sparkfun.com/tutorials/load-cell-amplifier-hx711-breakout-hookup-guide And using THEIR code. The only difference is I added a delay so it wouldn't ...
0
votes
0answers
51 views

Arduino button trigger coding

I am trying to write a simple coding to change the color of an RGB LED using a push button trigger. I just need the the pin output to change when the button is pressed. I would like to do this using ...
1
vote
0answers
886 views

Sending data from webserver to Arduino

Hello Arduino enthusiasts! I've been working on a keypad lock system for school lately and I need some advice.Basically, my code checks if the entered passcode is the same than a predefined passcode ...
0
votes
1answer
350 views

Servo issue, won't go into negative range

I'm trying to create a small laser "turret" with x-axis control. The arduino receives input through IR sensor. I'm having a problem where my servo will preform my up and reset function(moves and ...
0
votes
2answers
606 views

Keypad password check issue

I am working on a school project, basically I have to create a lock system that opens a fictive gate when the correct code is entered. We have been asked to simulate our system before actually ...
0
votes
1answer
68 views

My outputs are not outputting any current at only two of my pinmodes but work fine on the others

My pinMode output 5 and 6 don't works with this code but will work when they are stand alone. What is causing the Arduino to not output anything from these outputs within my code? #include <...
0
votes
1answer
523 views

Problem to display Ntp time on an oled using U8G2 lib

So I have this code to get ntp time and display it on serial port. But I want to display it on a 1.30 inch I2C oled with a SH1106 controller using the U8G2 library. The only problem is I don't know ...
1
vote
2answers
2k views

Sending Float values from Python to Arduino via serial communication

I want to Control the current flowing through a circuit using an Arduino. I have trained a PID controller for this purpose. I am using a current sensor to determine the error. It runs successful on my ...
-2
votes
2answers
2k views

Problem “Didn't find PN53x board” in Arduino Uno E-Card Reader [closed]

This is component to make E-Card reader, using arduino uno pn532 Code if (success) { // Display some basic information about the card Serial.println("Found an ISO14443A card"); Serial....
1
vote
1answer
228 views

When I turn on the servo it spins on its own before going to the right position and start the sketch

I can't get my head around this: when I turn the servo on it just spins on its own as if it's setting up, it goes to an angle superior to the one I want it to go. (Don't mind if it has to set up but ...
0
votes
1answer
921 views

Combining codes for 3 sensors [closed]

I am trying to combine codes for my 3 sensors: GSR, Pulse sensor, and ECG but I keep getting errors. I have a poor background in coding. I have the 3 codes separately and I'm not the one who wrote ...
1
vote
3answers
712 views

Arduino Uno “if” statement is ignored in code and halts execution when using Serial.ReadString()

I'm having a weird issue with my Uno trying to power on a PWM fan using a MOSFET. I'm setting a simple power on/off code using commands sent over the Serial Monitor, and although this code worked ...
1
vote
3answers
8k views

Getting error ets jan 8 2013,rst cause:4,boot mode(1,6) wdt reset

I'm working on a project to send ultrasonic sensor data to my webserver. For that I'm using ESP8266 WiFi module, 3.3V regulator IC by giving input volt of 5v from aduino uno. I successfully uploaded ...