Click here to Skip to main content
15,851,242 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: , +
Hi I just bought raspberry pi since I found it very interesting.I want to know how from a circuitry (push button to print 1,2,3 or 4) can be displayed to the web server or somewhere in the computer to store. For the video of circuitry and codes is :
#!/usr/bin/env python
import RPi.GPIO as GPIO
import time
import web

GPIO.setup(13, GPIO.OUT)
GPIO.setup(11, GPIO.IN)
GPIO.setup(15, GPIO.OUT)
GPIO.setup(12, GPIO.IN)
GPIO.setup(19, GPIO.IN)
GPIO.setup(24, GPIO.IN)
GPIO.setup(21, GPIO.OUT)
GPIO.setup(26, GPIO.OUT)

while 1:
        if GPIO.input(11):
         GPIO.output(13, False)
         print "2"
         GPIO.output(13, True)
        if GPIO.input(12):
         GPIO.output(15, False)
         print "1"
         GPIO.output(15, True)
        if GPIO.input(19):
         GPIO.output(21, False)
         print "3"
         GPIO.output(21, True)
        if GPIO.input(24):
         GPIO.output(26, False)
         print "4"
         GPIO.output(26, True)

Then I use putty to connect to the raspberry pi wirelessly then running the program in root so putty black screen would show 1 or 0 if I press the respective push button. Now I was wondering how to send these output data of the circuitry to the web server or some where to store in the pc(cause my colleague is goin to grab the 1,2,3,4 for other reasons. In conclusion when I press the button that suppose to display a 4, it will display in the webserver or notepad maybe for e.g. Then press another button to display 3 so it will display 4 , 3 in the webserver or notepad and so on and so forth. I did see a tut from How do I send data from the Raspberry Pi to the PC about webpy but its manual and send like"hello world" which was typed and not from the output of python scripts. I'm not really good with codes it'll be a great help if the tut is specific,easy example/video.TY,i'm connected wirelessly using a wifi dongle
Updated 18-Feb-14 16:20pm

1 solution

You can install the lighthttp webserver on your pi and put the outputs there for your collegue to grab. if you need to push the information, you could push to a remote CGI on a webserver, or upload the data via FTP, there are numerous other methods if I understand your question.

sudo apt-get -y install lighttpd
sudo lighty-enable-mod fastcgi-php
sudo service lighttpd force-reload

For example, print your codes to a file every so often and move the file to

or add them to an index.html file located there.

I hope this puts you on the right path.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900