WebIOPi : control your Pi’s GPIO with a browser


314 posts   Page 4 of 13   1, 2, 3, 4, 5, 6, 7 ... 13
by pygmy_giant » Mon Nov 05, 2012 11:14 pm
Python might eventually become available for RISCOS on the Pi, but that would require a RISCOS entusiast to resurrect and re-cross-compile an old 2004 distribution...

As things stand, I'm not even certain that GCC is operational - but well see...
Posts: 1569
Joined: Sun Mar 04, 2012 12:49 am
by bitbitbit » Tue Nov 06, 2012 9:54 am
I'm quite new to javascript .......

I was studying the code.... for the file webiopi.js in 0.3 ver.... i see that each buttons, when clicked, does the function $.post(xxxxxxxx) ...... such that it posts a string/data to the terminal and python picks it up.... am I correct?

if so, then why is function updateUI () needed?

:oops: :oops: :oops: Sorry if my whole concept is totally wrong as i have never learnt javascript before...... :oops: :oops: :oops: :oops:
Posts: 30
Joined: Thu Aug 30, 2012 3:18 am
by trouch » Tue Nov 06, 2012 9:58 am
bitbitbit wrote:I'm quite new to javascript .......

I was studying the code.... for the file webiopi.js in 0.3 ver.... i see that each buttons, when clicked, does the function $.post(xxxxxxxx) ...... such that it posts a string/data to the terminal and python picks it up.... am I correct?

if so, then why is function updateUI () needed?

:oops: :oops: :oops: Sorry if my whole concept is totally wrong as i have never learnt javascript before...... :oops: :oops: :oops: :oops:


$.post(url) send a HTTP POST request to the python server.
updateUI() is related to the continuous polling, in order to update the user interface and display GPIO state.

WebIOPi - Raspberry Pi REST Framework to control your Pi from the web
http://store.raspberrypi.com/projects/webiopi
http://code.google.com/p/webiopi/
http://trouch.com
Posts: 308
Joined: Fri Aug 03, 2012 7:24 pm
Location: France
by bitbitbit » Tue Nov 06, 2012 10:12 am
trouch wrote:
bitbitbit wrote:I'm quite new to javascript .......

I was studying the code.... for the file webiopi.js in 0.3 ver.... i see that each buttons, when clicked, does the function $.post(xxxxxxxx) ...... such that it posts a string/data to the terminal and python picks it up.... am I correct?

if so, then why is function updateUI () needed?

:oops: :oops: :oops: Sorry if my whole concept is totally wrong as i have never learnt javascript before...... :oops: :oops: :oops: :oops:


$.post(url) send a HTTP POST request to the python server.
updateUI() is related to the continuous polling, in order to update the user interface and display GPIO state.


Thanks for the reply.....

if I write a new javascript using $.post() only plus using your webiopi python script.... does that sound okay to you?? :roll: :roll: :roll: :roll:
Posts: 30
Joined: Thu Aug 30, 2012 3:18 am
by trouch » Tue Nov 06, 2012 10:25 am
As it's noticed on the project page, you are welcome to use WebIOPi in the way you want !
- all bundled
- only the REST API
- though the javascript API...

check upcoming modifications on WebIOPi 0.5, you may found it use full for you !

WebIOPi - Raspberry Pi REST Framework to control your Pi from the web
http://store.raspberrypi.com/projects/webiopi
http://code.google.com/p/webiopi/
http://trouch.com
Posts: 308
Joined: Fri Aug 03, 2012 7:24 pm
Location: France
by bitbitbit » Tue Nov 06, 2012 10:30 am
trouch wrote:As it's noticed on the project page, you are welcome to use WebIOPi in the way you want !
- all bundled
- only the REST API
- though the javascript API...

check upcoming modifications on WebIOPi 0.5, you may found it use full for you !



thanks :cry: :cry: :cry: you're such a nice guy :cry: :cry:

yes.....I'll be very looking forward for the ver 0.5 :D :D :D :D
Posts: 30
Joined: Thu Aug 30, 2012 3:18 am
by Ant232 » Wed Nov 07, 2012 9:50 am
Looking forward to Ver 0.5 too. Your time and work is very much appreciated.

Thanks Trouch.
Posts: 71
Joined: Thu Jul 12, 2012 9:34 pm
by jcrossman » Fri Nov 09, 2012 5:50 pm
I'm loving Webiopi. I've got it installed and all working fine. I'm using it to interface with an Arduino and motor shield. I've programed my Arduino to move the motors forward if it detects input on digital pin 7. This works fine with a switch connected to the ground and 3.3v supply of the Arduino, but I can't get my Pi to turn pin 7 on. I've connected an led to a gpio output on my pi and it works fine. But when I connect it to my Arduino pin 7, nothing happens. My Arduino and pi are powered seperatly could this be the issue?
Thanks, Jason.
Posts: 4
Joined: Fri Nov 09, 2012 5:35 pm
by trouch » Fri Nov 09, 2012 8:13 pm
jcrossman wrote:I'm loving Webiopi. I've got it installed and all working fine. I'm using it to interface with an Arduino and motor shield. I've programed my Arduino to move the motors forward if it detects input on digital pin 7. This works fine with a switch connected to the ground and 3.3v supply of the Arduino, but I can't get my Pi to turn pin 7 on. I've connected an led to a gpio output on my pi and it works fine. But when I connect it to my Arduino pin 7, nothing happens. My Arduino and pi are powered seperatly could this be the issue?
Thanks, Jason.

you have to link arduino ground to rpi ground

WebIOPi - Raspberry Pi REST Framework to control your Pi from the web
http://store.raspberrypi.com/projects/webiopi
http://code.google.com/p/webiopi/
http://trouch.com
Posts: 308
Joined: Fri Aug 03, 2012 7:24 pm
Location: France
by jcrossman » Fri Nov 09, 2012 8:39 pm
Thanks trouch. I did try linking the grounds but it didn't work. I will try again now that I know I'm going down the right route and see if I can get it working.
To be clear, I shall run a wire directly connecting both grounds. Then run a seperate wire linking pi gpio to arduino pin 7, with a diode just in case.

Thanks, Jason.
Posts: 4
Joined: Fri Nov 09, 2012 5:35 pm
by trouch » Sat Nov 10, 2012 10:27 pm
HOT NEWS !
Software PWM added to webiopi (in all Python library, REST API and Javascript library)
Working hard to release it quickly !

WebIOPi - Raspberry Pi REST Framework to control your Pi from the web
http://store.raspberrypi.com/projects/webiopi
http://code.google.com/p/webiopi/
http://trouch.com
Posts: 308
Joined: Fri Aug 03, 2012 7:24 pm
Location: France
by FR4 » Sun Nov 11, 2012 7:41 am
Hi trouch. Loving your excellent work too. Somewhere you mentioned serial support for one of the future versions of webiopi. Will this be part of V0.5 ? Can´t find it in the changelog. Would be a nice feature for me. ;)
Posts: 2
Joined: Sun Nov 11, 2012 7:36 am
Location: Germany
by trouch » Sun Nov 11, 2012 3:29 pm
FR4 wrote:Hi trouch. Loving your excellent work too. Somewhere you mentioned serial support for one of the future versions of webiopi. Will this be part of V0.5 ? Can´t find it in the changelog. Would be a nice feature for me. ;)


Serial support is still on the roadmap, but I'm not sure to include it in WebIOPi 0.5.
I'm looking for an elegant way to include it in WebIOPi and also I2C and SPI too.
If it will not be included in WebIOPi 0.5, it will be in the version after.

Actually, you can already try pyserial from python with /dev/ttyAMA0 to use UART0.
As WebIOPi 0.5 could be used within your own python script, you will be able to mesh up pyserial with WebIOPi.

WebIOPi - Raspberry Pi REST Framework to control your Pi from the web
http://store.raspberrypi.com/projects/webiopi
http://code.google.com/p/webiopi/
http://trouch.com
Posts: 308
Joined: Fri Aug 03, 2012 7:24 pm
Location: France
by BerryPicker » Tue Nov 13, 2012 10:44 am
Thank you for making your creation "webiopi" available. For me it epitomises what the pi is all about; an fun way to learn programming, networking and control.

My intended remote control is a Fujitsu Siemens Pocket Loox bought off eBay. This has Microsoft Windows Mobile (WM5) as its operating system. Unfortunately its Internet Explorer WEB browser does not support client side processing (i.e. java script).

A potential solution could be to rely entirely on server side processing (i.e. within the Pi). I imagine that the graphic user interface, shown as images on the remote control screen, could be represented by html forms tick boxes. An html forms submit button would then be used to initiate requests and updates to and from the Pi. I intend to follow your use of the Pi's Python to provide the web server, exploiting its ability to process Common Gateway Interface (CGI) scripts to act upon the particular information submitted from the html form.

As Linux, Python and html forms are all new to me, I'd welcome comment on such an approach. Or, if someone has already realised a solution without client side processing, I'd be glad to hear of it.

Sources of learning I am finding useful are:
HTML Forms and Input
http://www.w3schools.com/html/html_forms.asp
Hands-on Python Tutorial
http://anh.cs.luc.edu/python/hands-on/3 ... index.html
Posts: 128
Joined: Tue Oct 16, 2012 3:03 pm
Location: The East of England
by trouch » Tue Nov 13, 2012 7:48 pm
BerryPicker wrote:My intended remote control is a Fujitsu Siemens Pocket Loox bought off eBay.

OMG ! I remember my cousin with his brand new "pocket pc" Loox, more than 10 years ago....
It should be a nice hack to connect it to Raspberry using webiopi
I suggest you to build a Windows Mobile App to use the webiopi REST API.
But it will be a pain, you'd rather buy an old android phone...

WebIOPi - Raspberry Pi REST Framework to control your Pi from the web
http://store.raspberrypi.com/projects/webiopi
http://code.google.com/p/webiopi/
http://trouch.com
Posts: 308
Joined: Fri Aug 03, 2012 7:24 pm
Location: France
by BerryPicker » Wed Nov 14, 2012 9:29 am
trouch wrote: I suggest you to build a Windows Mobile App to use the webiopi REST API.

Ah yes. If I can make the PDA work to the REST API, then hopefully it would remain compatable with your webiopi upgrades.
Posts: 128
Joined: Tue Oct 16, 2012 3:03 pm
Location: The East of England
by bitbitbit » Fri Nov 16, 2012 2:43 am
trouch wrote:HOT NEWS !
Software PWM added to webiopi (in all Python library, REST API and Javascript library)
Working hard to release it quickly !


unbelievable!! :D :D
exactly what I wanted!! can't wait!! :D :D :D :D :D :D :D
Posts: 30
Joined: Thu Aug 30, 2012 3:18 am
by trouch » Fri Nov 16, 2012 9:37 pm

WebIOPi - Raspberry Pi REST Framework to control your Pi from the web
http://store.raspberrypi.com/projects/webiopi
http://code.google.com/p/webiopi/
http://trouch.com
Posts: 308
Joined: Fri Aug 03, 2012 7:24 pm
Location: France
by BerryPicker » Sat Nov 17, 2012 3:42 pm
[quote="trouch"]WebIOPi 0.5 has been released !

Thank you for sharing your continuing development. I have a REV 2 board.
The picture shows my progress on a Pocket LOOX remote control.
WebIOPi_LOOX.JPG
WebIOPi_LOOX.JPG (37.18 KiB) Viewed 1830 times

I'm not sure whether to submit all requests in each submission, or whether submit them one request at a time. I've a long way to go, so its helpful and encouraging to be shown the way through that you've found.
Posts: 128
Joined: Tue Oct 16, 2012 3:03 pm
Location: The East of England
by trouch » Sat Nov 17, 2012 4:15 pm
very nice ! keep going ! so do you use the REST API ?
It cannot handle multiple change in one single POST request for now :(
I will use the same JSON notation as the full state getter (GET /*)

WebIOPi - Raspberry Pi REST Framework to control your Pi from the web
http://store.raspberrypi.com/projects/webiopi
http://code.google.com/p/webiopi/
http://trouch.com
Posts: 308
Joined: Fri Aug 03, 2012 7:24 pm
Location: France
by HeavensBlade » Sat Nov 17, 2012 5:15 pm
Hey everybody,
I wrote my own python script and html file but I dont know how to make the .py run after boot.
Do I need to register it in the /etc/init.d/webiopi ?
Posts: 26
Joined: Fri Aug 03, 2012 10:45 am
by trouch » Sat Nov 17, 2012 5:19 pm
HeavensBlade wrote:Hey everybody,
I wrote my own python script and html file but I dont know how to make the .py run after boot.
Do I need to register it in the /etc/init.d/webiopi ?


Oh sorry, I miss to documente this !
You have to edit (or copy) /etc/init.d/webiopi and change :
DAEMON_ARGS="-m webiopi $WEBIOPI_PORT"
to
DAEMON_ARGS="/path/to/my/script.py $WEBIOPI_PORT"

ie remove "-m" and change "webiopi" by your script path.
Last edited by trouch on Sat Nov 17, 2012 5:19 pm, edited 1 time in total.

WebIOPi - Raspberry Pi REST Framework to control your Pi from the web
http://store.raspberrypi.com/projects/webiopi
http://code.google.com/p/webiopi/
http://trouch.com
Posts: 308
Joined: Fri Aug 03, 2012 7:24 pm
Location: France
by Ant232 » Sat Nov 17, 2012 5:19 pm
Love it.. Thanks again for all the hard work. Already playing around with building the custom page I need. Works perfectly so far on my Galaxy S2 browser.
What is the best way to update webiopi when a new version comes out? Do you have to reinstall it?

I'm off to press the donate button for Trouch as I can only imagine how much time he has put into this.

Thanks again..
Posts: 71
Joined: Thu Jul 12, 2012 9:34 pm
by trouch » Sat Nov 17, 2012 5:29 pm
thanks for your support and giving your feedbacks !
writing webiopi take much of my free-time, for sure, and more by sharing it
around 100 hours in november for the 0.5 release
but I love what I do and I want to help RPi community, so I don't care ;)

follow http://code.google.com/p/webiopi/wiki/UPGRADE for upgrade instructions

WebIOPi - Raspberry Pi REST Framework to control your Pi from the web
http://store.raspberrypi.com/projects/webiopi
http://code.google.com/p/webiopi/
http://trouch.com
Posts: 308
Joined: Fri Aug 03, 2012 7:24 pm
Location: France
by BerryPicker » Sun Nov 18, 2012 12:51 pm
trouch wrote:very nice ! keep going ! so do you use the REST API ?
It cannot handle multiple change in one single POST request for now :(
I will use the same JSON notation as the full state getter (GET /*)


I'm still hoping that client side processing will not be necessary. My earlier picture shows a proof of concept test of a web page template containing no more than html and css parts (i.e. it works in an aging browser without scripts). I intend the drop down option box, shown in my LOOX screen at the bottom left, to be used to select screens for other WebiIOPi tasks which need different layouts and controls, as well as to logout. For these other control screens, although html forms has no slider control, it would seem to be possible to make do with a row of radio buttons (~10% accuracy) or a text box (as accurate as you want).

Although the WebIOPi REST API is aimed at client side processing, nevertheless, where appropriate, I'm thinking I can use the primatives and the names you define in your WebIOPi Wiki REST API. For example, my task equivalent to your "Set GPIO function", but within an html form is:
Code: Select all
<input type="radio" name="/GPIO/0/function" value="/in">
Assuming I've correctly inferred the placing of "/".

Hopefully sticking to your Wiki definitions where possible will help avoid confusion when trying to graft a new server side (Pi host) remote control user interface (i.e. a new YourScript.py) to the webiopi.py. I think the picture (adapted from Wikis) shows the architecture I'm trying to accomplish.
WebIOPi_LOOX_Arch.JPG
WebIOPi. No scripting in browser
WebIOPi_LOOX_Arch.JPG (58.64 KiB) Viewed 1781 times


At the moment, to avoid inadvertant operator mistakes, I'm favouring tapping the seperate submit button shown bottom right, but this would result in sending every control's setting at once, every time an update or change is sought. I'm thinking the extra processing of unchanged controls will not be significant. So, as you can see, I'm still feeling may way.
Posts: 128
Joined: Tue Oct 16, 2012 3:03 pm
Location: The East of England