Questions tagged [coding-standards]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
24
votes
8answers
12k 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 ...
24
votes
3answers
45k 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
3answers
63 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? ...
1
vote
2answers
2k views

Is RX1 and TX0 the same thing as TX and RX? Will there be a difference in the way I program it?

I have an Arduino. I'm not sure if RX1 and TX0 the same thing as TX and RX? Will there be a difference in the way I program it? For example, do I treat RX1 and TX0 as RX and TX in the Arduino IDE ...
1
vote
5answers
1k 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 ...
1
vote
0answers
111 views

Encoding clock signal into linear block codes

In the VirtualWire library, it is possible to encode the clock signal as the library is doing with 4b/6b coding. This is possible because VirtualWire uses convolutinal coding, where the information is ...
0
votes
2answers
74 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
1answer
35 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: // ...
0
votes
2answers
147 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 ...
0
votes
2answers
117 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 ...
0
votes
2answers
159 views

SD card and Arduino

Good day! I need help regarding the use of SD card on Arduino. I need to store some recorded music and I want the Arduino to process it. Do I need to add some module? And circuitry? Libraries and code....
0
votes
1answer
1k views

coding standards for bigger projects

I'm starting a decently sized project around arduino/ATMELavr, and I came to wonder if there are any commonly accepted C/C++ coding standards or style guidelines specifically aimed at embedded C++/...
-1
votes
3answers
251 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 ...
-1
votes
1answer
370 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 ...
-1
votes
2answers
1k views

SD Library writing char in a file

I'm trying to write into a file using this code from the example of the library: String dataString = ""; int sensor = 0; dataString += String(sensor); dataString += ","; sensor +=1; File dataFile = ...