Advertisement
RuiViana

Testa if float

Mar 26th, 2017
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1.  
  2. float gramas = 435.1;
  3. float units = 0;
  4. // --------------------------
  5. void setup()
  6. {
  7.   // Teste com 2610,65 / 6 = 435,11  entra no loop
  8.   //       com 2610.55 / 6 = 435.09 Não entra no loop
  9.   units =float(2610.65)  / float(6);
  10.   Serial.begin(9600);
  11.   Serial.println(units,2);
  12. }
  13. // --------------------------
  14. void loop()
  15. {
  16.   if (units >= gramas)
  17.     Serial.println("Entrou no if");
  18.   else
  19.    Serial.println("Não entrou no if");
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement