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
vote
1answer
54 views

How to Set the Control Register on the DS3231 RTC module for Arduino UNO R3?

I am using the DS3231 RTC connected to an Arduino UNO R3 for a project. I won’t go into detail, but I need to save power, therefore I am using the DS3231 Alarm Interrupt to wake the Arduino from sleep....
1
vote
1answer
44 views

Thermocouple and multimeter

I've put together this script that should allow my Arduino Mega to be show thermocouple readings on the serial monitor, whilst also showing readings of voltage and ohms across a given component. I'd ...
0
votes
1answer
148 views

How can I interrupt a delay() when a button is pressed?

I have created a device that allows my son to track time spent on activities and exchanges that time into a time he can use with his electronics (eTime). Full code in GITHUB I am having trouble ...
0
votes
1answer
49 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: ...
0
votes
1answer
67 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 ...
-3
votes
1answer
53 views

What is PWM actually? [closed]

tcommand=(pwm_value-480.0)/8.22; flapmag=(pwm_value-880)/41.0+10; In this piece of code used in arduino, I don't understand why PWM value is subtracted and divided like this. This is not my code. Any ...
1
vote
1answer
851 views

How do I send tweets with flame sensor and ESP8266?

I want to send tweets with flame sensor and ESP8266. My flame sensor is digital. I think everything is good but it doesn't send. This is my code: #define ag_ismi "SSID" #define ag_sifresi "PASSWORD" ...
1
vote
1answer
733 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 ...
0
votes
0answers
29 views

RF24 code not working:

I watched this video and used his transmitter code and receiver code. However, it's not working. There's no response from the receiver. The transmitter stuck at the loop: if (!radio.write( &data,...
1
vote
1answer
2k views

Arduino CC3000 websocket client

I am working for arduino websocket client with CC3000 wifi board from adafruit. I have usde this websocket example as a reference and modified to work with cc3000 wifi board. I am not able to connect ...
2
votes
2answers
599 views

Serial - Send data to Arduino while Arduino sending data

Arduino send data to PC each iteration. When I'm trying to send data to Arduino while receiving data from it, it takes too long. Serial.available() returns false even I sent data from PC. But if I add ...
0
votes
3answers
66 views

arduino circuit review/ safety review

I have the following circuit It has a simple dc motor that is OFF, and switches ON once a day for 2 seconds. I use MOSFET IRF540N as a switch I use L7805CV as a voltage regulator I would like to ...
-4
votes
1answer
36 views

expected '}' at end of input

hi i am getting this error, im guessing i have a bracket missing or one in the wrong place. any help is appreciate, still new at this. thank you (code bellow) #include <Wire.h> #include <...
1
vote
4answers
597 views

Student Code: map function not functioning

We made this code in class: int red = 6; int green = 7; int blue = 8; int pot = A0; int potVal = 0; int chosenColor = 0; void setup() { // put your setup code here, to run once: ...
1
vote
1answer
111 views

ESP8266 Webserver ESP8266WebServer variable html page (not as one const char)

The aim is to display a non-static html page depending on some variable condition. The code I created hast the problem, that the esp8266 is ressetting in the moment I request the page. const char ...
1
vote
1answer
167 views

ESP8266 Webserver ESP8266WebServer move Handler-Function in separate .h .c file

The plan is to create a bigger project and to split the ESP8266 webserver-code over several modules (.h .c files). The main problem is that the ESP8266WebServer server is not declared in the index.h ...
3
votes
1answer
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 ...
0
votes
1answer
194 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 ...
4
votes
1answer
225 views

Working with multiplexers for constant voltage output

I'm working on creating a circuit where I'm trying to have the ability to switch multiple strands of LED rope on and off at a time using an Arduino and a multiplexer. With my current configuration, ...
0
votes
0answers
39 views

How tocode and connect Quectel Bg96 development board to thingspeak?

Recently I have purchased a development board and I wanted to connect some sensors and send value to thingspeak(IOT cloud platform). Can Any one help me code please !!!!
2
votes
1answer
87 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 ...
0
votes
2answers
60 views

while(1) inside if conditional

if (!MDNS.begin("esp8266")) { Serial.println("Error setting up MDNS responder!"); while (1) { delay(1000); } } I know this will result in an infinite loop if the if conditional is ...
0
votes
0answers
48 views

lightshow project

Hello guys. I'm working on a little lightshow that has 3 extra feature's when i press the button. depending on the variable counter the lights should do something and it should message you that you ...
-1
votes
1answer
57 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
2answers
1k views

LED Blinking Using Push button

Whenever I upload the following program I am getting error message showing "expected initializer before interval". Kindly Help me to solve out this probleme. const byte button=2; const byte LED=10; ...
-1
votes
1answer
27 views

Sound sensor's output stucks to high values when I include a delay in the loop function

I use Waveshare's Sound Sensor module. I use this simple code to test the module: As you can see, the problem is that when I have a delay in the program, once the analogRead is bigger than 10 (by ...
-1
votes
1answer
77 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 ...
2
votes
2answers
80 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
470 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
474 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
0answers
32 views

when submit data to ESP8266, ets Jan 8 2013,rst cause:4, boot mode:(1,6) wdt occurs

I am trying to make my ESP8266(nodemcu) as a Web server. When my code operates, and user connects esp's wifi and enters '192.168.4.1/set_peroid' by IE or chrome, this webpage appears: This is ...
1
vote
1answer
316 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
0answers
25 views

How do I get my servo to turn using bluetooth, is this a glitch?

I'm very new to coding with arduino so please excuse my naivety, For an electronics assignment I am making a servo turn back and forth using a HM10 BLE however each time I press a button that sends '0'...
0
votes
2answers
34 views

My push button code doesn't work properly

I'm using an OLED display connected to a push button. I am trying to get my display to show two different values independently by using the push button to switch between them. Here is a snap of my ...
-1
votes
1answer
73 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
2answers
917 views

Arduino classes, can't get property value

I have tried hard to make a stepper motor work with a class, but I can't get a property returning its value in a method. I get 0 (zero) instead of 26 (expected) from _stepPin. I have tried this->...
1
vote
2answers
121 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 ...
0
votes
1answer
59 views

A confusing condition statements [closed]

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
24 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 ...
1
vote
3answers
326 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
139 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,...
2
votes
2answers
597 views

IR Remote code not activating ON/OFF states

The code below is for turning RGB lights on/off. The connections are as indicated in pin numbers. I found the resulting value of the buttons of the remote but when I used them in code it is not ...
0
votes
0answers
58 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
41 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
38 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
2answers
2k views

How do I stop a servo motor at the current position when using a serial port? I want it to remain in one position when receiving “0”

I am working on a project where I would like values received from an Xbox Kinect will activate components on my Arduino. Currently, I am trying to get a servo motor to turn on and rotate when the ...
0
votes
1answer
45 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
2answers
10k 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 ...
11
votes
1answer
207 views

Cloud function getting stopped Parse.com in loop when calling from Arduino-yun

I have created a cloud function using the Parse.com Javascript SDK and I am calling those functions from Arduino. Following is code for the hello function: Parse.Cloud.define("hello", function(...
1
vote
3answers
10k 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 ...