All Questions
8 questions
-1
votes
1
answer
350
views
Declaration of global variables in separate file: compiler conflict
So I have:
1/ My myapp.ino file, that includes src.h (implemented in src.cpp). Compiled for Arduino Uno.
2/ I also have a unit-tests.cpp file that is meant to test functions in src.cpp. Compiled for ...
2
votes
2
answers
1k
views
How to write nonblocking code, for polling sensor at 100 Hz
I'm using this piece of code to try to poll an IMU sensor at 100 Hz (for a AHRS sensor fusion library).
void loop(void)
{
// nonblocking code variables
static uint32_t last_ms;
uint32_t ms;
// ...
0
votes
1
answer
488
views
Scope of RtcDateTime object when declared outside of a function
I'm trying to merge 2 Arduino samples, in order to be able to use DS3231 RTC module with ESP8266 WiFi simple web server.
My RTC library is this:
https://github.com/Makuna/Rtc/wiki
Generally, to code ...
0
votes
1
answer
9k
views
Why using static volatile for variables and only static for arrays in TWI library?
I want to know why to declare variables with static volatile and arrays with only static in TWI library?
For example;
static uint8_t twi_masterBuffer[TWI_BUFFER_LENGTH];
static volatile uint8_t ...
0
votes
1
answer
164
views
How to keep a specific bit set all the time for bit masking I2C operations?
I've been working on I2C and I learned how to initialize, send and receive with I2C communication protocol.
Next, I wanted to run the LCD1602 I2C adapter. But the module has a different bit masking, ...
0
votes
2
answers
154
views
What is the opposite of this data operation?
If I store in an array a double-value in this format, in which format I should be able to read the same double out?
double myDouble = 12.123456;
byte myArray[] = {0x00, 0x00, 0x00, 0x00};
myArray[0] ...
1
vote
1
answer
2k
views
Why is my variable not getting updated?
I have the following snippet of code:
const unsigned long fiveMinutes = 5 * 60 * 1000UL;
unsigned long lastCheck = 0 - fiveMinutes;
unsigned long now = 0;
void loop() {
now = millis();
if ( now -...
1
vote
1
answer
7k
views
Converting float to String
How can I convert a float value into a String object without implementing any library?
I'd like to avoid using char array.