Commits

Tino de Bruijn committed ad830fa

Added rounding to 4 decimals on analog pins, as there is no meaning in the next decimals anyway

  • Participants
  • Parent commits 4832e41

Comments (0)

Files changed (1)

File pyfirmata/pyfirmata.py

         
     # Command handlers
     def _handle_analog_message(self, pin_nr, lsb, msb):
-        value = float((msb << 7) + lsb) / 1023
+        value = round(float((msb << 7) + lsb) / 1023, 4)
         # Only set the value if we are actually reporting
         try:
             if self.analog[pin_nr].reporting: