From b16091659cc9a724a8800f77e631643b4ab089ad Mon Sep 17 00:00:00 2001 From: Ryan Date: Wed, 18 Aug 2021 18:20:25 +1000 Subject: Move USB Host Shield and Arduino core to `lib/` (#13973) --- .../examples/adk/term_time/term_time.ino | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 lib/usbhost/USB_Host_Shield_2.0/examples/adk/term_time/term_time.ino (limited to 'lib/usbhost/USB_Host_Shield_2.0/examples/adk/term_time') diff --git a/lib/usbhost/USB_Host_Shield_2.0/examples/adk/term_time/term_time.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/adk/term_time/term_time.ino new file mode 100644 index 0000000000..a3f1dbc8cb --- /dev/null +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/adk/term_time/term_time.ino @@ -0,0 +1,50 @@ +#include +#include + +// Satisfy IDE, which only needs to see the include statment in the ino. +#ifdef dobogusinclude +#include +#include +#endif + +USB Usb; + +ADK adk(&Usb,"Circuits@Home, ltd.", + "USB Host Shield", + "Arduino Terminal for Android", + "1.0", + "http://www.circuitsathome.com", + "0000000000000001"); + +void setup() +{ + Serial.begin(115200); +#if !defined(__MIPSEL__) + while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection +#endif + Serial.println("\r\nADK demo start"); + + if (Usb.Init() == -1) { + Serial.println("OSCOKIRQ failed to assert"); + while(1); //halt + }//if (Usb.Init() == -1... +} + +void loop() +{ + uint8_t buf[ 12 ] = { 0 }; //buffer to convert unsigned long to ASCII + const char* sec_ela = " seconds elapsed\r"; + uint8_t rcode; + + Usb.Task(); + if( adk.isReady() == false ) { + return; + } + + ultoa( millis()/1000, (char *)buf, 10 ); + + rcode = adk.SndData( strlen((char *)buf), buf ); + rcode = adk.SndData( strlen( sec_ela), (uint8_t *)sec_ela ); + + delay( 1000 ); +} -- cgit v1.2.3