Hello everyone, I have a problem, I have a counter in Python and I would like to be able to change the value cont using Json from another computer, how can I do this.
(This is the file )
"the cont part is before (while)"
import json
from samplebase import SampleBase
from rgbmatrix import graphics
import RPi.GPIO as GPIO
import time
import sys
Hello everyone, I have a problem, I have a counter in Python and I would like to be able to change the value cont using Json from another computer, how can I do this.
(This is the file ) "the cont part is before (while)" import json from samplebase import SampleBase from rgbmatrix import graphics import RPi.GPIO as GPIO import time import sys
GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(21, GPIO.IN) GPIO.setup(24, GPIO.IN) GPIO.setup(18, GPIO.OUT, initial=0)
cont =0
while cont <= 101: inputValue = GPIO.input(21) inputValue1 = GPIO.input(24) if (inputValue == True): cont = cont - 1 print("Choche entrada " + str(cont)) if (cont==100): class GraphicsTest(SampleBase): def init(self, *args, *kwargs): super(GraphicsTest, self).init(args, **kwargs) def run(self): canvas = self.matrix font = graphics.Font() font.LoadFont("../../../fonts/texgyre-27.bdf")
time.sleep(0.2)
if (inputValue1 == True): cont = cont + 1 print("Salida" + str(cont)) if (cont==100): class GraphicsTest(SampleBase): def init(self, *args, *kwargs): super(GraphicsTest, self).init(args, **kwargs) def run(self): canvas = self.matrix font = graphics.Font() font.LoadFont("../../../fonts/texgyre-27.bdf")
time.sleep(0.2)
if (cont == 0): GPIO.output(18, 1) print ("parking lleno" + str(cont)) class GraphicsTest(SampleBase): def init(self, *args, *kwargs): super(GraphicsTest, self).init(args, **kwargs) self.parser.add_argument("-t", "--text", help="The text to scroll on the RGB LED panel") def run(self): canvas = self.matrix font = graphics.Font() font.LoadFont("../../../fonts/texgyre-27.bdf") LedChain = 4 red = graphics.Color(255, 0, 0) graphics.DrawText(canvas, font, 0.5, 23, red,"completo")
time.sleep(0.1)
if ((inputValue == True)or(inputValue1 == True)or(cont == 0)):
if name == "main": graphics_test = GraphicsTest()
time.sleep(0.1)
Thank you very much. @EdwardBetts @playpauseandstop @Milly @clj @taavi