File tree Expand file tree Collapse file tree 4 files changed +4
-71
lines changed Expand file tree Collapse file tree 4 files changed +4
-71
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -23,18 +23,8 @@ limitations under the License.
23
23
// The pin of the Arduino's built-in LED
24
24
int led = LED_BUILTIN;
25
25
26
- // Track whether the function has run at least once
27
- bool initialized = false ;
28
-
29
26
// Animates a dot across the screen to represent the current x and y values
30
27
void HandleOutput (float x_value, float y_value) {
31
- // Do this only once
32
- if (!initialized) {
33
- // Set the LED pin to output
34
- pinMode (led, OUTPUT);
35
- initialized = true ;
36
- }
37
-
38
28
// Calculate the brightness of the LED such that y=-1 is fully off
39
29
// and y=1 is fully on. The LED's brightness can range from 0-255.
40
30
int brightness = (int )(127 .5f * (y_value + 1 ));
Original file line number Diff line number Diff line change @@ -14,9 +14,8 @@ limitations under the License.
14
14
==============================================================================*/
15
15
16
16
#include < TensorFlowLite.h>
17
-
17
+ # include < RTduino.h >
18
18
#include " constants.h"
19
- #include " main_functions.h"
20
19
#include " model.h"
21
20
#include " output_handler.h"
22
21
#include " tensorflow/lite/micro/all_ops_resolver.h"
@@ -39,7 +38,7 @@ alignas(16) uint8_t tensor_arena[kTensorArenaSize];
39
38
} // namespace
40
39
41
40
// The name of this function is important for Arduino compatibility.
42
- void setup ( ) {
41
+ static void _sine_setup ( void ) {
43
42
tflite::InitializeTarget ();
44
43
45
44
// Map the model into a usable data structure. This doesn't involve any
@@ -78,7 +77,7 @@ void setup() {
78
77
}
79
78
80
79
// The name of this function is important for Arduino compatibility.
81
- void loop ( ) {
80
+ static void _sine_loop ( void ) {
82
81
// Calculate an x value to feed into the model. We compare the current
83
82
// inference_count to the number of inferences per cycle to determine
84
83
// our position within the range of possible x values the model was
@@ -113,3 +112,4 @@ void loop() {
113
112
inference_count += 1 ;
114
113
if (inference_count >= kInferencesPerCycle ) inference_count = 0 ;
115
114
}
115
+ RTDUINO_SKETCH_LOADER (" tfsine" , _sine_setup, _sine_loop);
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments