Closed octubot closed 5 years ago
Please do not make a separate issue with the same content. I am going to close this issue and re-open the issue you previously made so we can continue the discussion there:
https://github.com/adafruit/Adafruit_IO_Python/issues/102#issuecomment-523813124
hello everybody, I am trying to use adafruit digital output example. I did everything as it was explained. However, I did modify the code so it could in my BBB.
this is the code i used. :
""" 'digital_out.py' Example of turning on and off a LED from the Adafruit IO Python Client
Author(s): Brent Rubell, Todd Treece """
Import standard python modules import time
import Adafruit_BBIO.GPIO as GPIO
import Adafruit IO REST client. from Adafruit_IO import Client, Feed, RequestError
Set to your Adafruit IO key. Remember, your key is a secret, so make sure not to publish it when you publish this code! ADAFRUIT_IO_KEY = 'XXXXXXXXXXXX'
Set to your Adafruit IO username. (go to https://accounts.adafruit.com to find your username) ADAFRUIT_IO_USERNAME = 'XXXXXXXXXX'
Create an instance of the REST client. aio = Client(ADAFRUIT_IO_USERNAME, ADAFRUIT_IO_KEY)
GPIO.setup("GPIO0_20", GPIO.OUT)
try: # if we have a 'digital' feed digital = aio.feeds('digital') except RequestError: # create a digital feed feed = Feed(name="digital") digital = aio.create_feed(feed)
led set up while True: data = aio.receive(digital.key) if int(data.value) == 1: GPIO.output("GPIO0_20", GPIO.HIGH) print('received <- ON\n')
elif int(data.value) == 0: print('received <- OFF\n') GPIO.output("GPIO0_20", GPIO.LOW)
timeout so we dont flood adafruit-io with requests
time.sleep(0.5) However, I keep getting this error:
Traceback (most recent call last): File "aio1.py", line 38, in data = aio.receive(digital.key) File "/home/debian/.local/lib/python3.5/site-packages/Adafruit_IO/client.py", line 216, in receive return Data.from_dict(self._get(path)) File "/home/debian/.local/lib/python3.5/site-packages/Adafruit_IO/client.py", line 118, in _get self._handle_error(response) File "/home/debian/.local/lib/python3.5/site-packages/Adafruit_IO/client.py", line 108, in _handle_error raise RequestError(response) Adafruit_IO.errors.RequestError: Adafruit IO request failed: 404 Not Found - not found - API documentation can be found at https://io.adafruit.com/api/docs
please advise.
thank you.