What server and language do you use for Raspberry PI

Thread Starter

Parth786

Joined Jun 19, 2017
642
Make changes to this file to point to your web server rasbpi.py
When I am using your code I am getting this error

cd Downloads/Raspi_IoT_Home_Auto-master
pi@raspberrypi:~/Downloads/Raspi_IoT_Home_Auto-master $ sudo python rasbpi.py
File "rasbpi.py", line 19
print "setting GPIO 26 "
^
IndentationError: expected an indented block
 

Thread Starter

Parth786

Joined Jun 19, 2017
642
To use my code you have to host the files on a server.
What does it mean ? do you mean I have to do change in your code or I think you are saying that all those files will have to be executed on a server. What I have read and understand that server should be run on raspberry. Can you tell me, where the server are running ?
 
Last edited:

be80be

Joined Jul 5, 2008
2,395
This is what they did there polling a webserver.
What i did is install apache and php on my second computer I then run the rasbpi.py on my pi
I changed the code to point to my wedserver.
 

Thread Starter

Parth786

Joined Jun 19, 2017
642
This is what they did there polling a webserver.
What i did is install apache and php on my second computer I then run the rasbpi.py on my pi
I changed the code to point to my wedserver.
Actually I am also trying with my raspberry board. I want to do it this like you have done. I have also computer and pi. I have installed apache and php in pi. Do i have to install apcche and php in my computer?
 

be80be

Joined Jul 5, 2008
2,395
white space is all i see wrong
Code:
print status
                if status=='ON':
                print "setting GPIO 26"
                GPIO.output(26,True)
                elif status=='OFF':
                                GPIO.output(26,False)
it had white space after 26 " 26"
 

be80be

Joined Jul 5, 2008
2,395
try this
Code:
print status
                if status=='ON':
                print ("setting GPIO 26")
                GPIO.output(26,True)
                elif status=='OFF':
                                GPIO.output(26,False)
 

Thread Starter

Parth786

Joined Jun 19, 2017
642
Code:
import RPi.GPIO as GPIO
import urllib2
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(26,GPIO.OUT)
true = 1
while(true):
                try:
                        response = urllib2.urlopen('http://You.ser.add.com/buttonStatus.php')
                        status = response.read()
                except urllib2.HTTPError, e:
                                        print e.code
                except urllib2.URLError, e:
                                        print e.args
              print status
                if status=='ON':
                print ("setting GPIO 26")
                GPIO.output(26,True)
                elif status=='OFF':
                                GPIO.output(26,False)
still there is error
File "rasbpi.py", line 17
print status
^
IndentationError: unindent does not match any outer indentation level
 
Last edited:

be80be

Joined Jul 5, 2008
2,395
Try this I was going to mess with this today after work
Code:
 print status
                if status=='ON':
                print "setting GPIO 26"
                GPIO.output(26,True)
                elif status=='OFF':
 

Thread Starter

Parth786

Joined Jun 19, 2017
642
Need to no more about what you are using and what you turned on on your pi
The first thing I wrote Python program which turn on/off LED without web browser after that I was trying to turn on/off LED using web page. I was following your advice But Problem is that I am not successful yet to turn on/off LED using web browser.
 

be80be

Joined Jul 5, 2008
2,395
The disk you used with the pi is it the noob full install disk
I have a older one im sure cause i just looked you need a 8 g SD card now or bigger
 
Last edited:

be80be

Joined Jul 5, 2008
2,395
Thats why it don't work lol you have to install the stuff they put on the noob full.
I come's with software to use pi gpi0
 

Thread Starter

Parth786

Joined Jun 19, 2017
642
Thats why it don't work lol you have to install the stuff they put on the noob full.
I come's with software to use pi gpi0
I don't think there is matter of full noob. pi gpi0 is library we can download or install. there are many library for controlling gpio of Pi
 
Top