pirelay's People
pirelay's Issues
Apachie2 log shows: sudo: no tty present and no askpass program specified
The PiRelay does not work...However there is no error message displayed. Checking the apachie log file I found this message as I refresh the page:
**sudo: no tty present and no askpass program specified
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.**
I guess the PHP exec's sudo command asks for su password. Do you have an advise how could I fix this?
Cheers, Béla from Hungary.
Set GPIO to OFF
How can we set the GPIO to OFF State on page load.
https://sourceforge.net/p/raspberry-gpio-python/wiki/Home/
https://docs.python.org/2/library/sys.html
https://docs.python.org/2/library/json.html
#getting the main GPIO libraly
import RPi.GPIO as GPIO
#time and json
import time
import json
setting GPIO mode
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(22, GPIO.OUT)
GPIO.setup(23, GPIO.OUT)
GPIO.setup(24, GPIO.OUT)
GPIO.setup(25, GPIO.OUT)
GPIO.output(22, 1)
GPIO.output(23, 1)
GPIO.output(24, 1)
GPIO.output(25, 1)
setting a list of used pins
pins = [22, 23, 24, 25]
create empty list
arr = []
for loop from 0 to 3
for x in range(0,4) :
#putting all relays in on state if GPIO is not setup
#putting the relay state in the empty list
arr.append(not GPIO.input(pins[x]))
printing the list of state's in json format
print json.dumps({0:arr[0],1:arr[1],2:arr[2],3:arr[3]})
Already tried above but once you refresh the page it sets them to off again.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.