Python SyntaxError: invalid syntax

Python and python framework

Moderator: leecollings

Post Reply
jurg1505
Posts: 8
Joined: Sunday 07 July 2019 22:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Python SyntaxError: invalid syntax

Post by jurg1505 »

I am trying to set a servo with domoticz .
The script works when i set the hoek manualy.

When i try to get the value from Domoticz i get syntax error.
The link comes from https://www.domoticz.com/wiki/Mindergas.nl

What am i doing wrong ?

Code: Select all

import json
from jq import jq
import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(GPIO.BOARD)
GPIO.setup(03, GPIO.OUT)
pwm=GPIO.PWM(03, 50)
pwm.start(0)

hoek=`curl -s "http://127.0.0.1:8080/json.htm?type=devices&rid=59"  | jq '.result[0].Level'| tr -d '"'`

def SetAngle(angle):
        duty = angle / 18 + 2
        GPIO.output(03, True)
        pwm.ChangeDutyCycle(duty)
        sleep(1)
        GPIO.output(03, False)
        pwm.ChangeDutyCycle(0)

SetAngle(hoek)

pwm.stop()
GPIO.cleanup()
SyntaxError.jpg
SyntaxError.jpg (29.17 KiB) Viewed 571 times
Post Reply

Who is online

Users browsing this forum: domja and 1 guest