From a96d140548b9457428417be8453110e41a09e7e5 Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Wed, 7 May 2025 14:31:41 -0600 Subject: [PATCH] successfully counting calls and updating value based on call count --- application/app.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/application/app.py b/application/app.py index ea64590..3fc23eb 100755 --- a/application/app.py +++ b/application/app.py @@ -12,6 +12,8 @@ from gpiod.line import Direction, Value import signal import sys +n=0 + # set gpio lines def set_line_values(chip_path, line_values): value_str = {Value.ACTIVE: "Active", Value.INACTIVE: "Inactive"} @@ -65,13 +67,15 @@ class App: @cherrypy.expose @cherrypy.tools.json_out() def getData(self): - a = 'a few' - b = ' psi' - n = 42 - c = str(n) + b + global n + n = n + 1 + a = ' psi' + b = ' N' + p = str(n) + a + t = str(n) + b return { - 'pressure' : c, - 'thrust' : 'more N' + 'pressure' : p, + 'thrust' : t } -- 2.47.2