Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(2)  |  Call(1)  |  Derive(0)  |  Import(1)

        def reset_atmega(hardware=''):
    print "Resetting Atmega ..."
    if hardware == 'beaglebone':
        try:
            fw = file("/sys/class/gpio/export", "w")
            fw.write("%d" % (71))
            fw.close()
            fwb = file("/sys/class/gpio/export", "w")
            fwb.write("%d" % (73))
            fwb.close()
        except IOError:
            pass
        fw = file("/sys/class/gpio/gpio71/direction", "w")
        fw.write("out")
        fw.close()
        fwb = file("/sys/class/gpio/gpio73/direction", "w")
        fwb.write("out")
        fwb.close()
        fw = file("/sys/class/gpio/gpio71/value", "w")
        fw.write("0")
        fw.flush()
        fwb = file("/sys/class/gpio/gpio73/value", "w")
        fwb.write("0")
        fwb.flush()
        time.sleep(0.2)
        fw.write("1")
        fw.flush()
        fw.close()
        fwb.write("1")
        fwb.flush()
        fwb.close()
    elif hardware == 'raspberrypi':
        import RPi.GPIO as GPIO
        GPIO.setmode(GPIO.BCM)  # use chip pin number
        pinReset = 2
        GPIO.setup(pinReset, GPIO.OUT)
        GPIO.output(pinReset, GPIO.LOW)
        time.sleep(0.2)
        GPIO.output(pinReset, GPIO.HIGH)
    else:
        print "ERROR: forced reset only possible on beaglebone and raspberrypi"
        


src/l/a/LasaurApp-HEAD/backend/app.py   LasaurApp(Download)
from bottle import *
from serial_manager import SerialManager
from flash import flash_upload, reset_atmega
from build import build_firmware
from filereaders import read_svg, read_dxf, read_ngc
def reset_atmega_handler():
    reset_atmega(HARDWARE)
    return '1'