1

I have a RPi3 running on Ubuntu Mate 16.04, im planning to create a web app that has the capacity to control my raspberry pi. I have done some research and seen WebioPi but with my full effort in installing it, it always result to an error. Can PHP and Python work together to control my raspberry pi? I don't see much of tutorials, would be really a great help if you guys could give me some resources.. sorry i'm still new to RPi, python and php

goldilocks
  • 60,325
  • 17
  • 117
  • 234
Ralph
  • 177
  • 1
  • 3
  • 5

2 Answers2

1

The easiest method I've used for controlling the Pi and its GPIO pins like this is the Python based web framework Flask. The learning curve is fairly low and it has reasonably human-readable documentation.

There's an entry level Flask GPIO tutorial at mattrichardson.com that I found useful when I was getting started. The section 'Connecting the Web to the Real World' has a connection diagram and some sample code for a basic button reading program. The code's a little long to repost in its entirety here, but in essence it sets up a route to a single HTML page which responds to button presses on the Pi.

goobering
  • 10,750
  • 4
  • 40
  • 64
0

I know it's a little late, but I have written a fairly comprehensive library which integrates nicely with a WebSocket server. This allows you to make a non-polling browser app which can send/receive events in realtime.

It's a native PHP implementation, and includes GPIO, SPI, I2C and PWM for all current Pi Models.

calcinai/phpi-websocket is the demo which provides a basic scaffolding for what you'd need.

calcinai
  • 179
  • 1
  • 13