diff --git a/internal/orchestrator/app/generator/app_template/python/main.py b/internal/orchestrator/app/generator/app_template/python/main.py index 9ef98b13..fb56fb23 100644 --- a/internal/orchestrator/app/generator/app_template/python/main.py +++ b/internal/orchestrator/app/generator/app_template/python/main.py @@ -1,6 +1,15 @@ -def main(): - print("Hello World!") +import time +from arduino.app_utils import App -if __name__ == "__main__": - main() +print("Hello world!") + + +def loop(): + """This function is called repeatedly by the App framework.""" + # You can replace this with any code you want your App to run repeatedly. + time.sleep(10) + + +# See: https://docs.arduino.cc/software/app-lab/tutorials/getting-started/#app-run +App.run(user_loop=loop) diff --git a/internal/orchestrator/app/generator/testdata/app-all.golden/python/main.py b/internal/orchestrator/app/generator/testdata/app-all.golden/python/main.py index 9ef98b13..fb56fb23 100644 --- a/internal/orchestrator/app/generator/testdata/app-all.golden/python/main.py +++ b/internal/orchestrator/app/generator/testdata/app-all.golden/python/main.py @@ -1,6 +1,15 @@ -def main(): - print("Hello World!") +import time +from arduino.app_utils import App -if __name__ == "__main__": - main() +print("Hello world!") + + +def loop(): + """This function is called repeatedly by the App framework.""" + # You can replace this with any code you want your App to run repeatedly. + time.sleep(10) + + +# See: https://docs.arduino.cc/software/app-lab/tutorials/getting-started/#app-run +App.run(user_loop=loop) diff --git a/internal/orchestrator/app/generator/testdata/app-no-sketch.golden/python/main.py b/internal/orchestrator/app/generator/testdata/app-no-sketch.golden/python/main.py index 9ef98b13..fb56fb23 100644 --- a/internal/orchestrator/app/generator/testdata/app-no-sketch.golden/python/main.py +++ b/internal/orchestrator/app/generator/testdata/app-no-sketch.golden/python/main.py @@ -1,6 +1,15 @@ -def main(): - print("Hello World!") +import time +from arduino.app_utils import App -if __name__ == "__main__": - main() +print("Hello world!") + + +def loop(): + """This function is called repeatedly by the App framework.""" + # You can replace this with any code you want your App to run repeatedly. + time.sleep(10) + + +# See: https://docs.arduino.cc/software/app-lab/tutorials/getting-started/#app-run +App.run(user_loop=loop)