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.

term_time.ino 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #include <adk.h>
  2. #include <usbhub.h>
  3. // Satisfy IDE, which only needs to see the include statment in the ino.
  4. #ifdef dobogusinclude
  5. #include <spi4teensy3.h>
  6. #include <SPI.h>
  7. #endif
  8. USB Usb;
  9. ADK adk(&Usb,"Circuits@Home, ltd.",
  10. "USB Host Shield",
  11. "Arduino Terminal for Android",
  12. "1.0",
  13. "http://www.circuitsathome.com",
  14. "0000000000000001");
  15. void setup()
  16. {
  17. Serial.begin(115200);
  18. #if !defined(__MIPSEL__)
  19. while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
  20. #endif
  21. Serial.println("\r\nADK demo start");
  22. if (Usb.Init() == -1) {
  23. Serial.println("OSCOKIRQ failed to assert");
  24. while(1); //halt
  25. }//if (Usb.Init() == -1...
  26. }
  27. void loop()
  28. {
  29. uint8_t buf[ 12 ] = { 0 }; //buffer to convert unsigned long to ASCII
  30. const char* sec_ela = " seconds elapsed\r";
  31. uint8_t rcode;
  32. Usb.Task();
  33. if( adk.isReady() == false ) {
  34. return;
  35. }
  36. ultoa( millis()/1000, (char *)buf, 10 );
  37. rcode = adk.SndData( strlen((char *)buf), buf );
  38. rcode = adk.SndData( strlen( sec_ela), (uint8_t *)sec_ela );
  39. delay( 1000 );
  40. }