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.
Questions tagged [code-review]
253 questions
11
votes
1 answer
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(request, response) {
…
Abhijeet Kulkarni
- 111
- 4
9
votes
3 answers
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 as
void loop()
{
static unsigned long PrevTime;
…
ATE-ENGE
- 941
- 3
- 19
- 32
5
votes
3 answers
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 sequence), and now I wanted to use 2 buttons, one…
AndreFro
- 53
- 6
5
votes
2 answers
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;
boolean start;
unsigned int angle = 5; //angle moved…
TechPakoray
- 51
- 1
- 2
4
votes
2 answers
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 <= lightON; pos1 += 1) {
servo1.write(pos1);
…
Marcelo_M
- 121
- 1
- 7
4
votes
1 answer
NRF24L01 only receiving zeros
I'm attempting to transmit very simple data across some NRF24l01 modules for testing purposes, and I've been following a YouTube guide.
Here is my code:
Trasmitter:
#include "RF24.h"
#include
RF24 Radio (7, 8);
byte address[][6] =…
Wilson
- 41
- 3
4
votes
1 answer
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, I have the a circuit and a sketch that will cycle…
narner
- 267
- 1
- 3
- 17
4
votes
1 answer
Arduino Uno as keyboard
I am trying to make Arduino Uno to act as a keyboard. I have successfully flashed the USB-HID firmware in it using this link also and programmed it like this.
uint8_t buf[8] = {
0
};
int inpin1 = 7;
int inpin2 = 8;
int val1 = 0;
int val2 =…
Mayank Pal
- 41
- 1
- 4
3
votes
1 answer
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 across a roadblock in the code with using a…
Mario Ronci
- 61
- 3
3
votes
0 answers
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 and DS18B20 thermal probe.
My thermal probe is…
Roschlynn Dsouza
- 79
- 5
3
votes
2 answers
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 = lightOFF; pos1 <= lightON; pos1 += 1) {
…
Marcelo_M
- 121
- 1
- 7
3
votes
1 answer
Why is this looping?
I am trying to do something very simple. I want the LED to fade from full brightness to off. This works... However, the LED turns back on to full brightness and fades again, in a loop. I am not sure why. I think I am missing something obvious. …
Keltari
- 163
- 6
3
votes
3 answers
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;
...
if (someCondition == true)
{
…
Sören
- 41
- 1
- 3
3
votes
1 answer
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 safety reasons, if the Arduino loses communications…
Prdufresne
- 177
- 8
3
votes
3 answers
How to correctly use functions that return pointers to multiple typedef'ed types in Arduino IDE?
I have a program that typedef's two structs. Each one has a corresponding function that returns a pointer to it....
typedef struct {
int x1;
} x;
x *a;
x *f(void) {
return a;
}
typedef struct {
int y1;
} y;
y *b;
y *g(void)…
bigjosh
- 1,593
- 10
- 13