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.
2323// The pin of the Arduino's built-in LED
2424int led = LED_BUILTIN;
2525
26- // Track whether the function has run at least once
27- bool initialized = false ;
28-
2926// Animates a dot across the screen to represent the current x and y values
3027void 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-
3828 // Calculate the brightness of the LED such that y=-1 is fully off
3929 // and y=1 is fully on. The LED's brightness can range from 0-255.
4030 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.
1414==============================================================================*/
1515
1616#include < TensorFlowLite.h>
17-
17+ # include < RTduino.h >
1818#include " constants.h"
19- #include " main_functions.h"
2019#include " model.h"
2120#include " output_handler.h"
2221#include " tensorflow/lite/micro/all_ops_resolver.h"
@@ -39,7 +38,7 @@ alignas(16) uint8_t tensor_arena[kTensorArenaSize];
3938} // namespace
4039
4140// The name of this function is important for Arduino compatibility.
42- void setup ( ) {
41+ static void _sine_setup ( void ) {
4342 tflite::InitializeTarget ();
4443
4544 // Map the model into a usable data structure. This doesn't involve any
@@ -78,7 +77,7 @@ void setup() {
7877}
7978
8079// The name of this function is important for Arduino compatibility.
81- void loop ( ) {
80+ static void _sine_loop ( void ) {
8281 // Calculate an x value to feed into the model. We compare the current
8382 // inference_count to the number of inferences per cycle to determine
8483 // our position within the range of possible x values the model was
@@ -113,3 +112,4 @@ void loop() {
113112 inference_count += 1 ;
114113 if (inference_count >= kInferencesPerCycle ) inference_count = 0 ;
115114}
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