DexterInd / DexterInd/GrovePi

Multiple Relays

Open
#237 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
494
Forks
472
PR merge metrics
No merged PRs in 30d

Description

We've bought three relays, and we use the following Python Class to interact with the relay (see attached file). Nothing complicated. It's just Python 3 and more object encapsulation.

The problem we have is that when we set off a relay, the two other relays also set off ! Which is not what we're expected.

For example:

r1 = Relay(5)
r2 = Relay(6)
r3 = Relay(7)

r1.on()
r2.on()
r3.off() # r1 and r2 are now off ...

We observed the same problem without the object encapsulation. And thus we suspect that the problem is coming from GrovePi.

Is it a know bug? Or is GrovePi intended to only work with one relay?

relay.py.txt

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the attached relay.py file and the GrovePi relay behavior described in the issue. Reproduce the example using relay pins 5, 6, and 7, then inspect whether the behavior comes from the Python class or GrovePi. Done means determining the cause and ensuring each relay can be switched independently, if the hardware supports it.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, raspberry-pi
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.