Advertisement
RuiViana

Sprint_Float.ino

Jul 25th, 2018
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.95 KB | None | 0 0
  1. #include <LiquidCrystal.h>                                                  // Biblioteca LCD standard
  2. //LiquidCrystal lcd(A0, A1, A2, A3, A4, A5);                                // Instancia e ports para conexao do LCD
  3. LiquidCrystal lcd(8, 9, 4, 5, 6, 7);                                        // Instancia e ports para conexao do LCD
  4.  
  5. //----------------------------------------
  6. void setup()
  7. {
  8.   Serial.begin(9600);
  9.   lcd.begin(16, 2);                                                         // Inicialisa LCD
  10. //  lcd.print("Testando LCD    ");                                          // Print
  11. //  Serial.println("Testando Serial");                                      // Print
  12.  
  13.   float f = 123.12F;
  14.  
  15.   char str[50];
  16.   sprintf(str, "Valor : %d.%02d", (int)f, (int)(f * 100) % 100);
  17.   lcd.print(str);                                                           // Print
  18.   delay(2000);
  19. }
  20. //----------------------------------------
  21. void loop()
  22. {
  23.   ;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement