2
votes
if statement does not work with fraction, but works with decimal equivalent
1/440 will be treated as an integer expression, returning zero.
To make it work, make one or both operands a floating-point type. In your case:
if(t >= (float)1 / 440){ //Fraction
t = 0;
}
Or:...
1
vote
Asynchronous function calls in Arduino sketch
You can definitely make asynchronous code on devices with only one thread. This is what the "static" keyword is for in C. It helps you to setup functions as a "state machine" so ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
sketch × 258programming × 95
arduino-uno × 77
arduino-ide × 21
c++ × 21
uploading × 20
serial × 19
arduino-nano × 17
c × 14
arduino-mega × 13
sensors × 12
led × 11
library × 10
motor × 9
esp8266 × 8
wifi × 7
bootloader × 7
servo × 6
adafruit × 6
code-review × 6
arduino-yun × 6
variables × 6
compile × 6
arduino-leonardo × 5
temperature-sensor × 5