Skip to main content

Questions tagged [constants]

Constants in programming are definitions whose value is fixed throughout a program's execution. Literals in most languages are constants, for example. In referentially transparent programming styles, all definitions are constant.

1 vote
1 answer
710 views

I have to measure the pH value for some experiment. I have checked various codes and all include the average of pH values. #define SensorPin 0 // the pH meter Analog output is connected with ...
Jashanjot Kaur's user avatar
1 vote
1 answer
692 views

For example constant of MSBFIRST, It used to as input in SPI.setBitOrder(MSBFIRST). But sadly i don't know the type data of MSBFIRST. This is applied to like SPI_MODE0 and other.
Muhammad Ikhwan Perwira's user avatar
1 vote
0 answers
460 views

I'm declaring an array at top level like so: constexpr byte a[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; // whatever data I'm referencing the array in such a way that it's not optimized away. When ...
adrianton3's user avatar
3 votes
1 answer
373 views

I'm kind of new in the Arduino world. I decided to make a self learning project with an Arduino where it controls a conveyor that simply moves from right to left and back again. There is a start and ...
Carlos Costa's user avatar
-1 votes
1 answer
120 views

Good day! How to set sensor Data parameters? Like the data only set for example it starts with minimum value of 3 and ends with maximum value of 6 and it will turn on led 1 and if minimum value of 1 ...
Reiniel Cirujano Antonio's user avatar
0 votes
1 answer
149 views

When creating an array like in the sketch #include <Lib.h> int myArray[Lib::len]; void setup() {} void loop() {} the variable len must be an integer constant that is known at compile time. ...
LukasFun's user avatar
  • 295
1 vote
1 answer
304 views

I see a lot of people, but also libraries, defining constants (like pin numbers, length of items etc) as #define: #define LENGTH 5 While it is recommended to use in this case static const int: ...
Michel Keijzers's user avatar
-1 votes
1 answer
977 views

In an ISR I want to keep things quick. At the same time I want to limit variable scope. Storage space is not a factor. I have this line: const char trigs[] = "aAbBcCdDeEfFgGhHiIjJ"; When this is ...
Jim Mack's user avatar
  • 269
2 votes
1 answer
415 views

I was trying to compile some Arduino code on the PC for testing when I noticed some strange syntax for numerical binary constants. Convetion seems to be to declare them like so: static const ...
user1273684's user avatar
1 vote
1 answer
790 views

I'm working on a project for the arduino uno for which I need multiple constant arrays of bytes. Such an array is initialized like so: const byte charR[] PROGMEM = { B01111111,//top half ...
Bo Thompson's user avatar
0 votes
1 answer
2k views

A newbie in Arduino- and I'm trying to concatenate string and chars ( well in python it is quite different ). I'm trying to post a MQTT message- constructed following format to the client.publish(...
guyd's user avatar
  • 1,049
2 votes
2 answers
446 views

Preamble: I am trying to figure out how to program and use the timers in the Feather M0 using the Arduino IDE. I have seen a number of examples published, but I'm not one to just blindly copy some ...
BE-Bob's user avatar
  • 23
2 votes
2 answers
3k views

I'm working on a project where I need to create a JSON to send back state of an object. I created the code to achieve it and all works fine, but I used this to declare the JSON fields: static const ...
Noisemaker's user avatar
2 votes
2 answers
25k views

Why I'm getting this error? invalid conversion from 'const char*' to 'char' [-fpermissive] Here is my simple sketch: const char data = "should"; //I have also tried: //const char* data = "should"; ...
Kirill's user avatar
  • 151
0 votes
1 answer
60 views

In my sketch I have the following: #define HU_ADDR 0x190; #define ALL_AUDIO_ADDR 0x1FF; #define MY_ADDR 0x360; #define UNKNOWN_ADDR 0xFFF; typedef ...
Bo Thompson's user avatar

15 30 50 per page