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
1 answer
45 views

Relays fail to engage/disengage when prompted initially in setup code for Arduino ATmega2560 and 2560 proto shield

The following code is what I have written so far. All of my pin connections, declarations, and writes seem to be correct, but when I implement the code, none of my relays (Smart Board Relay Modules) ...
1 vote
1 answer
80 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
688 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
2 answers
960 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 votes
1 answer
77 views

Arduino not reacting sometimes when reading serial commands

When I am sending hex numbers via computer to the arduino leonardo, it sometimes won't react, but the serial monitor says that it was sent. My code; void setup() { Serial.begin(9600); pinMode(...
1 vote
1 answer
129 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 ...
-1 votes
1 answer
151 views

error: expected unqualified-id before 'if' if (send) { but all semicolons are available [closed]

I am getting a compilation error: expected unqualified-id before 'if' . Btu I have check all the semicolons . Please help finding my error. The rest of the message error reads C:\Users\jecalderon\...
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 ...
0 votes
2 answers
72 views

Pin outping 1V instead of expected 5V, not hardware related

Heyo everyone ! I'm in a project where I need to send a signal if I detect vaccuum. I'm sending the signal on PIN 9 but I soon realized that I was only getting 1V. Tought I was alternating between ...
-2 votes
2 answers
83 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 ...
0 votes
1 answer
69 views

Combined code to run a 2-zone radiant floor system. Cannot get 'RadiantMain' to work. Better description in beginning of code [duplicate]

Trying to combine code to run a 2-zone radiant floor heating system. The menu code works perfectly. When I select MenuC 'Run main' it executes to RadiantMain prints test and then returns to menu ...
-2 votes
1 answer
157 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
2 answers
110 views

Stoplight Simulator - White LED not turning on with button press [closed]

I am working on a relatively simple stoplight simulator that uses four LEDs - red, green, yellow, and white - in addition to a button. The 3 colored stoplight LEDs cycle as a real stoplight would. If ...
1 vote
1 answer
17k views

Problem with a DHT11 Temperature & Humidity sensor

I'm new in the Arduino world and today i was trying to make a simple program to show the temparature an humidity with this sensor. I made a circuit following one tutorial and nothing happend, the ...
1 vote
1 answer
211 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(),...
-1 votes
1 answer
1k views

Wemos D1 mini freezing after a few minutes

I´m using a Wemos D1 mini board to control a RGB LED Strip and programmed a simple code with the Arduino IDE. The Wemos conects to my Internet just fine and with the IP adress I can change the RGB ...
2 votes
1 answer
78 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 ...
0 votes
1 answer
103 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 &...
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
371 views

How to override automatic control in Blynk app?

I am a beginner to Blynk, and have successfully built a simple water temperature control project. It consists of an ESP32, a plug-in water heater, and an AC relay board. The ESP32 controls the relay ...
1 vote
0 answers
189 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 ...
0 votes
1 answer
2k views

I get an error saying, "exit status 1 expected initializer before 'void'." [closed]

I will be wiring a switch to the Arduino that controls the voltage. When the I turn the switch it can adjust the voltage from 0 to 5. The overall task is to print the output voltage. The print is to ...
-1 votes
1 answer
123 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 ...
0 votes
1 answer
394 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 ...
2 votes
2 answers
140 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 ...
3 votes
0 answers
397 views

Integration of MAX30100 and DS18B20 Thermal Probe Integration

This is for my final year project that I have been tasked with designing a patient monitoring system. However, during the last stretch of model prototyping, I am experiencing issues with my MAX30100 ...
-1 votes
1 answer
110 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. ...
1 vote
1 answer
917 views

Arduino Mega TIMER1 one second interval

Is this timer set correctly for Arduino Mega? It should count exactly one second. And why when I print in serial monitor (seconds_passed++) is it incremented by 2 not by 1? Full code on Pastebin: ...
3 votes
2 answers
228 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 =...
2 votes
2 answers
497 views

Turning a motor on and a led at the same time for a given time period

I need help with this code, I want to have a motor turn on for a given time and at the same time have an led light up to indicate it is on which will also turn of once the motor has stopped. It is ...
1 vote
1 answer
509 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 vote
1 answer
120 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
125 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
0 answers
103 views

RFM69 Sending Failure

Hi I'm trying to get the RFM69 rf module to work on an arduino uno. Here is my code: #include <SPI.h> // Addresses for this node. CHANGE THESE FOR EACH NODE! #define NETWORKID 0 // Must be ...
1 vote
4 answers
3k 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
1 answer
223 views

Quick Programming Check/Review

I've been racking my head trying to start programming in a library organized method. My code works, but the translation and split to a .h and .cpp file is riddled with errors. It's gotta be stupidly ...
1 vote
0 answers
30 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 votes
1 answer
45 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:...
1 vote
1 answer
944 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 ...
5 votes
2 answers
7k views

DC Motor Speed Measurement using Rotary Encoder

I have written the following code to measure the speed of a unidirectional DC Motor.I have attempted to measure the time between successive interrupts in order to calculate speed. boolean check; ...
0 votes
1 answer
230 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: ...
2 votes
2 answers
15k 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 ...
1 vote
1 answer
186 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 ...
3 votes
0 answers
2k views

Encoder + Bounce2 Library

I am working towards debouncing my keyes rotary encoder using the Bounce2 library found here ( https://github.com/thomasfredericks/Bounce2 ). I believe the problem lies in my code as there isn't much ...
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
465 views

a code to implement a simple traffic signal and also display on LCD which color is ON?

I have tried code given below for simple traffic signal and also display on LCD which color is ON, but it didn't work. Please me to make it work. int red = 10; int yellow = 9; int green = 8; #include ...
0 votes
1 answer
686 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 ...
0 votes
2 answers
263 views

Print when echo is read by HR-S04 sensor

I'm trying to see when an echo is received by my HR-S04 sensor. I have a Serial.println within my while loop to read the signal and see once a change happens to break the loop. The issue is my serial ...
2 votes
2 answers
189 views

Unwanted ghosting with charlieplexed LEDs

I have a very simple PCB that uses 3 GPIO on a ATtiny85 to control 6 LEDs using charlieplexing. When I try to program certain patterns of lit LEDs (pseudo PWM) I get some LEDs lighting dimly when they ...
1 vote
2 answers
655 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 (...

1
2 3 4 5 6