GrovePi Zero Ports [SOLVED]


#1

I have the GrovePi Zero come with 1 Digital Port, 1 I2C port, 3 Analog Ports & 1 Serial Port.
From the GrovePi projects most of it using 2 or more Digital Ports, would you please advise
how to solve the issue.
Thanks


#2

The analog ports can work as digital ports too. We have a pinout diagram for GrovePi+ here. The GrovePi0 will have a similar port pinout so you can use it with multiple digital signals too.


#3

Thank you for your reply.

Yes I got it and work ok.

I have been trying the GrovePi/Project/Sensor_Twitter_Fee/Wifi_twit.py
project.

Created new app at Twitter with all the necessary Keys and etc.

When I run the file it came out with the following words

“Duplicate Tweet Or Twitter Refusal”

What is the problem, is it not connected to Twitter?

Please advise

Thanks again


#4

Hi @frankieyip

For some reason, Twitter is not accepting your tweet. There’s one case that’s valid and that’s the “duplicate tweet”. If you are sending the same text twice, Twitter will not let you post it. Is that the case here? Have you been able to get one tweet up?

If you haven’t had a single tweet out, then it’s the keys and app permissions that are problematic . I haven’t taken a look at that project for a couple of months. Let me refresh my memory a bit. It’s also possible that Twitter changed something on their side but I don’t think so.

Cleo


#5

Ok, I’m back from testing.
Twitter hasn’t changed and my old keys still work, thankfully!
One thing that may be missing from the tutorial write-up is that the keys need to have a read-write access
I don’t remember if that’s by default or if it has to be set that way. This might be something to double check in your setup.

Cleo


#6

Ya I have tried the 3 settings in Twitter

  1. Read only

  2. Read and write

  3. Read, write and Access direct messages

All of it cannot connect to Twitter

May I know the meaning of the following sentences written in Twitter
APPLICATION SETTINGS

" This key should never be human-readable in your application"

Is it the problem because copy & paste the key words which is human
readable

Application Settings
Keep the “Consumer Secret” a secret. This key should never be
human-readable in your application.

Please advise

Thanks


#7

The idea behind the keys is that they should be well protected. If you were to sell a product that tweets you would need to protect those keys seriously. As the code resides on your own Pi and you are not distributing the code (at least not at this stage) you do not need to encrypt the keys. Mine aren’t encrypted and they work just fine. I simply don’t share the code.
Just like I won’t ask you to share your keys even though it would help in debugging your situation.

Can you try the following code: (do replace your 4 keys as needed)

import twitter
api = twitter.Api(
    consumer_key='your_key',
    consumer_secret='your_key',
    access_token_key='your_key',
    access_token_secret='your_key'
    )

out_str ="Just testing"
api.PostUpdate(out_str)

and report the error you’re getting?
Cleo


#8

Hi Cleoqc

I had tried out and the result is:

Traceback (most recent call last):
File “/home/pi/Twitter Testing.py”, line 3, in
api = twitter.API(
AttributeError: ‘module’ object has no attribute ‘API’

Please advise

Thanks


#9

Ok, well that helps… Did you install the twitter module? And if so which one? There are more than one out there. My guess is that the wrong one got installed.

You need to run this to get the one that works with the example code:
sudo pip install python-twitter


#10

Hi Cleoqc

I got all the sensors working.

I reformatted the SD Card and reload all the software.

Problem solved.

Thanks


#11

Yeah!!
Thanks for letting us know it’s solved.


#12