Page 1 of 1

Webiopi script throws GPIO error

Posted: Sat Sep 17, 2016 6:10 pm
by nautilus27
Hi guys,

I'm building myself a rover. So today I installed Webiopi to my Raspberry Pi 3 using instructions on this page: https://github.com/doublebind/raspi

Then I did write some code from this example: https://issuu.com/themagpi/docs/issue_9 ... 23/2587746

Code: Select all

import webiopi
GPIO = webiopi.GPIO

L1=17
L2=18
R1=22
R2=23

def turn_right ():    
	GPIO.output(L1,GPIO.LOW)
	GPIO.output(L2,GPIO.HIGH)
	GPIO.output(R1,GPIO.HIGH)
	GPIO.output(R2,GPIO.LOW)

def turn_left ():
	GPIO.output(L1,GPIO.HIGH)
	GPIO.output(L2,GPIO.LOW)
	GPIO.output(R1,GPIO.LOW)
	GPIO.output(R2,GPIO.HIGH)

def forward():
	GPIO.output(L1,GPIO.LOW)
	GPIO.output(L2,GPIO.HIGH)
	GPIO.output(R1,GPIO.LOW)
	GPIO.output(R2,GPIO.HIGH)

def backward():
	GPIO.output(L1,GPIO.HIGH)
	GPIO.output(L2,GPIO.LOW)
	GPIO.output(R1,GPIO.HIGH)
	GPIO.output(R2,GPIO.LOW)

GPIO.setFunction(L1, GPIO.OUT)
GPIO.setFunction(L2, GPIO.OUT)
GPIO.setFunction(R1, GPIO.OUT)
GPIO.setFunction(R2, GPIO.OUT)

server.addMacro(turn_right)
server.addMacro(turn_left)
server.addMacro(forward)
server.addMacro(backward)


server = webiopi.Server(
	    port=8000,
	    login="cambot",
	    password="cambot")

webiopi.runLoop()

server.stop()
But I'm getting this error when I try to run it:

Code: Select all

Traceback (most recent call last):
  File "rover.py", line 2, in <module>
    GPIO = webiopi.GPIO
AttributeError: 'module' object has no attribute 'GPIO'

Re: Webiopi script throws GPIO error

Posted: Mon Sep 19, 2016 10:48 am
by pcmanbob
Hi.

you may stand a better change of finding an answer if you asked on the Webiopi forum

https://groups.google.com/forum/#!forum/webiopi

Re: Webiopi script throws GPIO error

Posted: Mon Sep 19, 2016 11:13 am
by scotty101
Someone has already asked that question

https://groups.google.com/forum/#!topic ... p-9WvtcUUo