3
The failing is not with your code. The failing is with the MPU6050_6Axis_MotionApps20.h library. It erroneously has code in the header rather than in a separate CPP file.
You have done everything right. The author of that library could do well in taking a leaf out of your book.
To get it working you will have to move the code out of the header file into the ....
3
This looks like a rounding problem. If the number you want to print lies
within the open interval (9.95, 10), the condition value < 10 is true,
as the number is strictly less than 10. Obviously, value != 10 is also
true. Yet, lcd.print(x, 1) will round the number to the closest
multiple of 0.1, which in this case is 10.
I see no better solution than ...
2
I would suggest a bit field for storing the days of the week when the
alarm is supposed to fire:
bit 0: fire on Sundays
bit 1: fire on Mondays
...
This numbering is meant to match the one of DateTime::dayOfTheWeek().
Pack this, together with the hour and minute of the alarm, in a struct
(or a class if you prefer). Maybe add a boolean to tell whether the
...
1
You can do this easily by using Arduino built-in PWM function and using delay function. But remember that using delay in your code will block your code so if your program just want to sit and wait for 3 seconds at some speed then delay is ok for you else you need to implement Millis function.
first you need to define different speeds as per your requirement ...
1
That would work. Though I feel like your solution isn't easily readable by humans, and also not easily readable by machines.
Removing the |s, making the data a fixed length, and putting each alarm on separate line, would help with both. You'd get something like
ON MTWTFSS 14:00
OFF MT T S 10:00
Because the data-string is of a fixed length, you know where ...
Only top voted, non community-wiki answers of a minimum length are eligible
Related Tags
programming × 1550arduino-uno × 543
c++ × 194
arduino-mega × 124
serial × 122
arduino-ide × 122
c × 101
sketch × 91
sensors × 88
esp8266 × 57
led × 52
library × 49
arduino-nano × 47
motor × 47
lcd × 38
string × 37
array × 37
servo × 34
code-review × 32
pins × 31
communication × 31
interrupt × 30
bluetooth × 24
arduino-due × 22
button × 22