Questions tagged [coding-standards]
The coding-standards tag has no summary.
19 questions
-1
votes
1
answer
412
views
How to send a group message to multiple receivers using GSM900 and Arduino Mega2560?
I'm working on a project and it can send to one receiver only. What I need is to send a message to multiple receivers. I need a code sample that would satisfy my needs. Please help! I need to finish ...
2
votes
1
answer
90
views
Doubt in coding part in blink without delay
Code 1 (here unsigned long currentmillis = millis() is in loop area):
const int LED = 2;
unsigned long previousmillis = 0 ;
const long delaytime = 1500;
int ledstate = HIGH;
void setup() {
pinMode(...
12
votes
1
answer
11k
views
Which C++ standard does the Arduino language support?
The "Arduino language" (as they call it) of the Arduino IDE 1 is obviously C++. Which C++ exactly?
I tried to figure it out myself (Arduino IDE 1.8.13 for Arduino Uno), but I can't conclude ...
32
votes
4
answers
60k
views
Is it better to use #define or const int for constants?
Arduino is an odd hybrid, where some C++ functionality is used in the embedded world—traditionally a C environment. Indeed, a lot of Arduino code is very C like though.
C has traditionally used #...
1
vote
0
answers
64
views
Why does the LED state behave differently?
I wanted the sensor to be high when I press the button, but when DigitalRead does low, the LED turns on, when it does high, the LED goes off.
Whereas when the digitalRead is high, isn't it supposed to ...
1
vote
3
answers
174
views
variable name standards, e.g best method to send motion_detect=true
I am working with some sensors and sending data to a public web server via http, I was thinking this server can be possibly used by more people to send their data and server displays a chart.
I was ...
1
vote
1
answer
335
views
Are there any standard ways of reporting a runtime error?
I'm new to Arduino but I'm an experienced programmer. I'm wondering if there are any common functions for reporting errors in Arduino programs? For example, in JavaScript we have the alert() function, ...
2
votes
3
answers
132
views
Code with if multible conditions
My project has 4 float switches, 2 valves and 3 pumps. I created a sketch and uploaded it. But my project keep all "OUTPUT" at "HIGH" all the time. I couldn't find what the problem, can you help?
...
0
votes
1
answer
90
views
Do You Put a Break after the Last case in a Switch? [closed]
The Arduino Switch Case Reference has a switch structure written two different ways:
First in the Syntax as:
switch (var) {
case label1:
// statements
break;
case label2:
// ...
-1
votes
3
answers
497
views
Help with arduino float
I am having trouble with this code:
#include <Wire.h>
#include <MPU6050.h>
MPU6050 mpu;
// Timers
unsigned long timer = 0;
float timeStep = 0.01;
// Pitch, Roll and Yaw values
float ...
0
votes
2
answers
182
views
GPS and Arduino [closed]
I am working on a project with an Arduino Uno. I want to know if the latitudes and longitudes can be input to the Arduino for the Arduino to move to that particular location. If it's possible then ...
1
vote
5
answers
3k
views
Do Arduinos meet military standards?
Do Arduinos meet military standards?
If not, where does it fall short? Is it something internal to the chip which might be corrected via external circuit? How could I evaluate the potential of a ...
29
votes
8
answers
21k
views
Are global variables evil in Arduino?
I'm relatively new at programming and many of the coding best practices I'm reading effectively state that there are very few good reasons to use a global variable (or that the best code has no ...
0
votes
2
answers
114
views
While doesn't the loop terminate?
I have a have project of Up Down counter using Arduino with seven segments, in which when I continuously press the push button, the counter moves upward from 0 to 99. When I release the push button, ...
0
votes
2
answers
381
views
Altering SoftwareSerial to transmit more than 1 byte at a time
I am trying to create a stable communication channel without any mis-synchronization. In the SoftwareSerial library, the write function transmits one byte at a time. The mis-synchronization occurs ...