Git Product home page Git Product logo

Comments (10)

joan2937 avatar joan2937 commented on September 26, 2024

It's as if the daemon isn't running. That is the most likely explanation. I've just tried the same with Python 3.4 and have opened a socket manually and via the pigpio Python module.

N.B. I'm using a new version of the Python module which instantiates a class for each Pi (so more than one Pi can be controlled from one Python script).

joan@soft /ram $ sudo pigpiod
joan@soft /ram $ pigs t
740687050
joan@soft /ram $ pigs t
743243930
joan@soft /ram $ python3.4
Python 3.4.1rc1 (default, May 5 2014, 20:18:18)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.

import pigpio
local = pigpio.pi()
local.get_current_tick()
796894514
local.get_current_tick()
798635451
local.get_hardware_revision()
2
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('localhost', 8888))
s
<socket.socket fd=5, family=AddressFamily.AF_INET, type=SocketType.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 37841), raddr=('127.0.0.1', 8888)>

joan@soft /ram $ pigs t
914567397
joan@soft /ram $

I suggest you use pigs to confirm the daemon is running.

from pigpio.

jonasdagefoerde avatar jonasdagefoerde commented on September 26, 2024

Here is my system setup: Ubuntu 12.04, Python 3.2, latest pigpio from github installed

I checked the process via ps

ps aux
[...]
root      9565 18.3  1.2  13552  5764 ?        SLsl 12:21   0:00 pigpiod
[...]

Result using pigs (after a long waiting time)

$ pigs t
connect failed

Using your code snippet

>>> import pigpio
>>> p = pigpio.pi()
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Can't connect to pigpio on localhost(8888)

Did you start the pigpio daemon? E.g. sudo pigpiod

Did you specify the correct Pi host/port in the environment
variables PIGPIO_ADDR/PIGPIO_PORT?
E.g. export PIGPIO_ADDR=soft, export PIGPIO_PORT=8888

Did you specify the correct Pi host/port in the
pigpio.pi() function? E.g. pigpio.pi('soft', 8888))
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>>> import socket
>>> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>>> s.connect(('localhost', 8888))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
socket.error: [Errno 110] Connection timed out

It looks like the daemon is running but not responding whatsoever...strange

from pigpio.

joan2937 avatar joan2937 commented on September 26, 2024

Ubuntu?

So you are running the pigpio Python module on a PC and connecting to the pigpio daemon running on a Pi?

You need to specify the name or IP address of the Pi running the daemon. Either as an argument to pigpio.start() (or pigpio.pi() if using the latest, 16, version of the library) or by setting the PIGPIO_ADDR environment variable.

export PIGPIO_ADDR=soft

from pigpio.

jonasdagefoerde avatar jonasdagefoerde commented on September 26, 2024

Sorry for the mistake and confusion: the pigpiod daemon and the python program are both executed on the RPi (running Raspbian). I am working within an ssh session from an Ubuntu 12.04 machine.

from pigpio.

joan2937 avatar joan2937 commented on September 26, 2024

Is the current situation that pigpiod is running but is not responsive?

Does pigs work? It uses the same socket interface as the Python module.

pigs t # show current tick
pigs pigpv # show library version
pigs hwver # show Pi's hardware revision

Does

cat /dev/pigerr&

spit out any error messages?

Use

sudo killall -USR2 pigpiod
sudo killall -USR2 pigpiod
sudo killall -USR2 pigpiod
sudo killall -USR2 pigpiod
sudo killall -USR2 pigpiod

to bump the internal debug level.

sudo killall -USR1 pigpiod
sudo killall -USR1 pigpiod
sudo killall -USR1 pigpiod
sudo killall -USR1 pigpiod
sudo killall -USR1 pigpiod
sudo killall -USR1 pigpiod

to reverse the process.

Do

./x_pigs
./x_pipe

work?

from pigpio.

jonasdagefoerde avatar jonasdagefoerde commented on September 26, 2024

Hi Joan,
sorry for my late response: I had to set up and configure my RPi from scratch after a gpio-unrelated system crash. The good news: after re-installing everything, I did clone the current repo, did a make, make install, started the pigpiod daemon and voila: the daemon is running and responding. Unfortunately I have no idea why it didn't work before I had to re-install everything.

Thanks a lot for your support and immediate responses. I am looking forward to finally implement my little servo project. If I somehow find out why this all happened, I let you know.

Cheers,
Jonas

from pigpio.

joan2937 avatar joan2937 commented on September 26, 2024

Hi Jonas,

In that case I'll close this as an issue. If the problem reappears we can start a new issue.

Regards,

from pigpio.

lucentbeam avatar lucentbeam commented on September 26, 2024

Hi, so I know this issue is closed, but I wanted to comment incase other encounter it.

I was struggling with this quite a bit and only solved it after working with another program and realizing I couldn't ping localhost. It turns out when I had followed a guide to setting up an automatic wlan network (this is the culprit: http://weworkweplay.com/play/automatically-connect-a-raspberry-pi-to-a-wifi-network/), I had turned off the loopback network. So pigpiod would still run and listen on a port just fine, but the scripts could never open a socket and reach it. I believe this is why Jonas's issue was resolved by a reinstall.

In any case, to others who encounter this: make sure that there's a "LOOPBACK" network appearing when you type "ifconfig." If not, check that there's a line "auto lo" in your /etc/network/interfaces file. Here's an article that helped me: https://scottlinux.com/2012/06/09/cant-ping-localhost-in-linux/

from pigpio.

joan2937 avatar joan2937 commented on September 26, 2024

Thanks for that information. It's something I wasn't aware of and I'll try to bear it in mind if I come across the same problem again.

from pigpio.

jugg1es avatar jugg1es commented on September 26, 2024

@lucentbeam Thanks for your post, I followed the same wifi tutorial and had the same problem. Your post saved me from having to settle on RPi.GPIO pwm, thanks!

from pigpio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.