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
0
votes
1answer
621 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
407 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
442 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
252 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
28 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
321 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 ...
1
vote
1answer
82 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
1k 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
2k 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 ...
1
vote
0answers
215 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 ...
2
votes
0answers
2k 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
2k 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
1k 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
70 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
918 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
5k 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 ...
-1
votes
2answers
4k 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
679 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
2k 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
2k 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 ...
2
votes
2answers
13k 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 ...
0
votes
2answers
2k views

Pause running program using a pushbutton

I have a program that flashes three LED in sequence indefinitely. How can O program a pushbutton to pause the program in the middle of the code? Also, can I modify the code so that pressing the ...
0
votes
2answers
2k 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; ...
0
votes
2answers
2k views

SSID was not declared in this scope

so I am new to arduino and coding in general, I am trying to use the arduino to remotely survey plants, I am using this guide: https://create.arduino.cc/projecthub/arduino/plant-communicator-7ea06f. ...
-1
votes
2answers
3k views

Need help on the "expected primary expression before "}" token"

#include <SPI.h> #include <nRF24L01.h> #include <RF24.h> #include "Arduino.h" #include "SoftwareSerial.h" #include "DFRobotDFPlayerMini.h" #define M11 2 #define M12 3 #define M13 ...
1
vote
1answer
584 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 ...
0
votes
1answer
1k views

Code is not working (Matrix keypad) [closed]

I am new to Arduino. I am learning from Arduino Cookbook. I was using tinkercad.com for running my Arduino code. But it is not working. The Serial monitor should show the key which I have pressed on ...
0
votes
1answer
1k views

Arduino Servo with Serial

I have an interesting problem. I want to control ESC and servo with Arduino. I'm using HC-12 to communicate with 2 Arduino and I'm using SoftwareSerial on the nano. #include <SoftwareSerial.h> ...
0
votes
1answer
2k views

Checksum is wrong - Air Quality Monitoring Station PMS5003, BME280 | Code review

I working at air quality station. I measure particulate matter with PMS5003 and meteorological parameters with BME280. Everything seems to work just fine, but sometimes program hangs on checksum ...
1
vote
2answers
2k views

Problem opening multiple text files simultaneously/in-order using <SD.h>

I am looking to log analog sensor data using 3 pins, A1, A2, A3. My project requires continuous mapping of data, and hence an SD card shield was necessary. However, I need to log the incoming data ...
-2
votes
1answer
817 views

I keep getting stray '/302'. [duplicate]

I even rewrote the code and it still didn't work. How can I fix this? #include "pitches.h" void setup() { // put your setup code here, to run once: pinMode(4, OUTPUT); } void loop() { // ...
3
votes
1answer
102 views

My Arduino freezes if power removed from the HMI

I have an Arduino (Pro Mini) connected to an HMI display over serial. When the user pushes a button on the HMI screen, it activates a relay attached to one of the digital pins on the Arduino. For ...
9
votes
4answers
1k views

delay(time); vs if(millis()-previous>time); and drift

Going through an old project, I had code on two Arduino Due that looked like this void loop() { foo(); delay(time); } taking to heart the majority of literature on using delay(); I recoded this ...
1
vote
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 ...
1
vote
1answer
15k 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
2answers
966 views

Communication with socketserver fails after specific number of packets

I'm trying to implement a full-duplex communication between my ESP8266 and a socketserver running on my laptop. In concrete I need each of the devices to initiate communication whenever it needs to. ...
-1
votes
2answers
378 views

interrupt not triggered correctly

I have an arduino uno and want to react to three sensors, which should trigger an ISR. I wrote the following program, and for sensor 3 it works, however the other two sensor don't seem to trigger an ...
1
vote
2answers
14k views

Change the baud rate of HC-05

#include <SoftwareSerial.h> SoftwareSerial BTSerial(10, 11); // RX | TX void setup() { pinMode(9, OUTPUT); // this pin will pull the HC-05 pin 34 (key pin) HIGH to switch module to AT mode ...
0
votes
2answers
516 views

Strings from serial are not equal

In my code I have that string:String code = rs1 + rs2 + rs3; //rs1=034, rs2=000, rs3=017 It means that code = "034000017". But if I run if (code.equals("034000017")) Serial.println("OK"); There is ...
0
votes
2answers
396 views

Speed measurement from lidar sensor for automatic braking system

For a school project I have been working on a system that will automatically brake when there is danger. Only the requirements are more strict (safety) than just using a ping sensor and detecting a ...
1
vote
1answer
475 views

How to only detect the opening and closing of door sensor once

im quite new to Arduino coding. Currently im trying to create an alarm and when the alarm ring, the user will just need to remove the door sensor once to stop the alarm and listen for the next alarm. ...
0
votes
1answer
1k views

Integer array definitions: Length

I'm defining a variable as integer and want to use thati int specLength = 17; int spec[specLength-1]; When I do this, I get the following error message: TestProgram:34: error: array bound is not ...
1
vote
2answers
227 views

Why do I have to open Serial Monitor to display what is in loop function?

Why do I have to open Serial Monitor to display non-NaN values retrieved from DHT22, what am I doing wrong in the code below? #include <DHT.h> #include <Wire.h> #include <...
1
vote
2answers
419 views

motor hard stop vs coasting

I'm using this motor driver with 2 of these motors to control a skid steer robot. To get the robot to coast to a stop, I use this code: analogWrite(MotLPWM, 0); //coast to stop analogWrite(...
1
vote
1answer
655 views

I2C Packet ocasionally send a garbage data

I have a project with Arduino working as I2C slave. The master request data each 300ms. The code of Arduino is: /* Name: SimpleClass_Applcation.ino Created: 5/26/2017 4:18:28 PM Author: ...
0
votes
1answer
110 views

Arduino UNO Intro to Engineering Project [closed]

I am a college student in an intro to engineering class looking to create a final project. My goal is to create a small "present" that opens its lid via a servo and plays jingle bells with LEDs ...
1
vote
1answer
92 views

Having trouble with 74HC595 and Uno

Just picked up a couple of 74HC595 shift registers to use for my Arduino Uno, and I'm having trouble getting it working 100% of the time. My code is to get a value from the Serial monitor and shift it ...
0
votes
1answer
298 views

Make 3 servos move like a wave

I am having some trouble programming 3 servos to move like a wave. So, for instance, all my servos start at 90 degrees. I want my first servo to move and when it reaches 135 degrees I want my second ...
-1
votes
2answers
4k views

Counting number of people inside a room [closed]

I want to count the number of people in a room using a microcontroller (Arduino Uno). I have 2 ultrasonic sensors at a doorway about a 1.5m apart from each other. I want to increment the number when ...
-1
votes
1answer
159 views

Need help to find code error to send AT command response in sms

I know that there is something wrong in my code bellow because I don't get "OK" as response in the SMS when I use Serial.print ("AT") . "AT" is an AT command. I am using the example 2 of http://forum....