Beispiel #1
0
# Instantiate the server on the port 8000, it starts immediately in its own thread
server = webiopi.Server(port=3333, login="******", password="******")

# Register the macros so you can call it with Javascript and/or REST API

server.addMacro(curtain_open)
server.addMacro(curtain_close)
server.addMacro(curtain_stop)
server.addMacro(l1_on)
server.addMacro(l1_off)

# -------------------- #
# Loop                 #
# -------------------- #

# Run our loop until CTRL-C is pressed or SIGTERM received
webiopi.runLoop()

# -------------------- #
# Termination          #
# -------------------- #

# Stop the server
server.stop()

# Reset GPIO functions
GPIO.setFunction(OPEN, GPIO.IN)
GPIO.setFunction(CLOSE, GPIO.IN)
GPIO.setFunction(L1, GPIO.IN)
Beispiel #2
0
def led_off():
	number = 9
	writeNumber(number)
	time.sleep(1)
	
# Start the webiopi server
server = webiopi.Server(port=8000, login="******", password="******")

# Start the webcam video stream
os.system("streamer.sh")

# Register the macros
server.addMacro(stop)
server.addMacro(forward)
server.addMacro(left)
server.addMacro(right)
server.addMacro(backward)
server.addMacro(stop)
server.addMacro(servo_centre)
server.addMacro(servo_left)
server.addMacro(servo_right)
server.addMacro(led_on)
server.addMacro(led_off)

# Run default loop

webiopi.runLoop()

# Cleanly stop the server
server.stop()
Beispiel #3
0

if __name__ == "__main__":
    """
  execution starts here
  """

    # webiopi.setDebug() # be verbose on stderr

    teletype.init(webiopi.GPIO)

    server = webiopi.Server(port=80, coap_port=None)

    #server.host="192.168.42.1"

    # add the macros which the browser will call
    server.addMacro(baud_rate_inc)
    server.addMacro(baud_rate_dec)
    server.addMacro(tty_start)
    server.addMacro(tty_stop)
    server.addMacro(tty_tx)
    server.addMacro(tty_tx_str)
    server.addMacro(tty_tx_ctl)
    server.addMacro(tty_test)

    webiopi.runLoop(loop)  # never exits

    server.stop()  # Cleanly stop the server

    teletype.motor_stop()  # cleanly stop the tty
Beispiel #4
0
server.addMacro(spot)
server.addMacro(dock)
server.addMacro(control)
server.addMacro(power)
server.addMacro(start)
server.addMacro(wake)
server.addMacro(led_on)
server.addMacro(led_off)
server.addMacro(MacroWithArgs)

# -------------------------------------------------- #
# Loop execution part                                #
# -------------------------------------------------- #

# Run our loop until CTRL-C is pressed or SIGTERM received
webiopi.runLoop(loop)

# If no specific loop is needed and defined above, just use 
# webiopi.runLoop()


# -------------------------------------------------- #
# Termination part                                   #
# -------------------------------------------------- #

# Stop the server
server.stop()

# Reset GPIO functions
#GPIO.setFunction(LS, GPIO.IN)
#GPIO.setFunction(L1, GPIO.IN)
Beispiel #5
0
 
if __name__ == "__main__":
  """
  execution starts here
  """

  # webiopi.setDebug() # be verbose on stderr

  teletype.init(webiopi.GPIO)

  server = webiopi.Server(port=80,coap_port=0)

  #server.host="192.168.42.1"

  # add the macros which the browser will call
  server.addMacro(baud_rate_inc)
  server.addMacro(baud_rate_dec)
  server.addMacro(tty_start)
  server.addMacro(tty_stop)
  server.addMacro(tty_tx)
  server.addMacro(tty_tx_str)
  server.addMacro(tty_tx_ctl)
  server.addMacro(tty_test)

  webiopi.runLoop(loop)  # never exits 

  server.stop() # Cleanly stop the server

  teletype.motor_stop() # cleanly stop the tty
Beispiel #6
0
server.addMacro(go_forward)
server.addMacro(go_backward)
server.addMacro(turn_left)
server.addMacro(turn_right)
server.addMacro(stop)
server.addMacro(led_on)
server.addMacro(led_off)
server.addMacro(MacroWithArgs)

# -------------------------------------------------- #
# Loop execution part                                #
# -------------------------------------------------- #

# Run our loop until CTRL-C is pressed or SIGTERM received
webiopi.runLoop(loop)

# If no specific loop is needed and defined above, just use 
# webiopi.runLoop()


# -------------------------------------------------- #
# Termination part                                   #
# -------------------------------------------------- #

# Stop the server
server.stop()

# Reset GPIO functions
#GPIO.setFunction(LS, GPIO.IN)
#GPIO.setFunction(L1, GPIO.IN)