Digital Ports all Reading 1

Can anyone tell me why my digital ports are all outputting 1 regardless of whether I have something connected to them?

thanks
Jen

import grovepi
import time

while True:
	d1=grovepi.digitalRead(1)
	d2=grovepi.digitalRead(2)
	d3=grovepi.digitalRead(3)
	d4=grovepi.digitalRead(4)
	d5=grovepi.digitalRead(5)

	#output the data
	print("D1", d1)
	print("D2", d2)
	print("D3", d3)
	print("D4", d4)
	print("D5", d5)

	#read roughly 10 times a second
	time.sleep(0.1)

Output:

('D1', 1)
('D2', 1)
('D3', 1)
('D4', 1)
('D5', 1)

So for example, if I run the Button and Buzzer example, the buzzer will just sound continuously because it thinks the button is always being pressed.

Also write does work, i.e. the LED blink code will blink the LED. But read won’t work.

What firmware are you currently running on the GrovePi and what library are you using? Are they both updated to the latest?

To check the firmware version, run:

import grovepi
print(grovepi.version())

And to see how old your library is, check if you can access the works_with_firmware list in the grovepi module.

Thank you!

Firmware 1.3.0

As for libraries, how do find that out?
I used the image from 018.06.27_Raspbian_For_Robots_by_Dexter_Industries-stretch.zip

1.3.0
D1 1
D2 1
D3 1
D4 1
D5 1

That’s interesting, so I just ran the update shorcut from the desktop and now I get:

1.3.0
D1 1
D2 1
D3 0
D4 0
D5 0

Should D1 and D2 be reading as 1? Also if I add a button to d4, it does not read as 1 when pressed

Update : after adding a Buzzer to d2 and running the buzzer and button test, the button has started outputting 1s…weird?