• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
2
3Licensed under the Apache License, Version 2.0 (the "License");
4you may not use this file except in compliance with the License.
5You may obtain a copy of the License at
6
7    http://www.apache.org/licenses/LICENSE-2.0
8
9Unless required by applicable law or agreed to in writing, software
10distributed under the License is distributed on an "AS IS" BASIS,
11WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12See the License for the specific language governing permissions and
13limitations under the License.
14==============================================================================*/
15
16// Template sketch that calls into the detailed TensorFlow Lite example code.
17
18// Include an empty header so that Arduino knows to build the TF Lite library.
19#include <TensorFlowLite.h>
20
21// TensorFlow Lite defines its own main function
22extern int tflite_micro_main(int argc, char* argv[]);
23
24// So the example works with or without a serial connection,
25// wait to see one for 5 seconds before giving up.
26void waitForSerial() {
27  int start = millis();
28  while(!Serial) {
29    int diff = millis() - start;
30    if (diff > 5000) break;
31  }
32}
33
34// Runs once when the program starts
35void setup() {
36  waitForSerial();
37  tflite_micro_main(0, NULL);
38}
39
40// Leave the loop unused
41void loop() {
42}