You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

scale.ino 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /* Digital Scale Output. Written for Stamps.com Model 510 */
  2. /* 5lb Digital Scale; any HID scale with Usage page 0x8d should work */
  3. #include <hid.h>
  4. #include <hiduniversal.h>
  5. #include <usbhub.h>
  6. #include "scale_rptparser.h"
  7. // Satisfy the IDE, which needs to see the include statment in the ino too.
  8. #ifdef dobogusinclude
  9. #include <spi4teensy3.h>
  10. #include <SPI.h>
  11. #endif
  12. USB Usb;
  13. USBHub Hub(&Usb);
  14. HIDUniversal Hid(&Usb);
  15. Max_LCD LCD(&Usb);
  16. ScaleEvents ScaleEvents(&LCD);
  17. ScaleReportParser Scale(&ScaleEvents);
  18. void setup()
  19. {
  20. Serial.begin( 115200 );
  21. #if !defined(__MIPSEL__)
  22. while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
  23. #endif
  24. Serial.println("Start");
  25. if (Usb.Init() == -1)
  26. Serial.println("OSC did not start.");
  27. // set up the LCD's number of rows and columns:
  28. LCD.begin(16, 2);
  29. LCD.clear();
  30. LCD.home();
  31. LCD.setCursor(0,0);
  32. LCD.write('R');
  33. delay( 200 );
  34. if (!Hid.SetReportParser(0, &Scale))
  35. ErrorMessage<uint8_t>(PSTR("SetReportParser"), 1 );
  36. }
  37. void loop()
  38. {
  39. Usb.Task();
  40. }