Hi all,
For a school project I am building a device using a Raspberry Pi 4, Grove Base Hat and a LED socket.
My goal for now is to blink the LED light on and off.
This is what I’ve done so far.
-
Connected the Grove Base Hat on to the Raspberry Pi 4.
-
Started up the Raspberry Pi, opened up a terminal and ran
sudo raspi-config
. Inside the interface options I enabled the I2C then clicked on finish. Andsudo reboot
. -
I opened up a terminal and ran
curl -sL https://github.com/Seeed-Studio/grove.py/raw/master/install.sh | sudo bash -s -
Installation was done successfully.
-
Turned off the Raspberry Pi. Connected 3 light sockets on D5, D22 and D24. Then turned the Raspberry Pi on.
-
cd Desktop
and Thennano led.py
.
I wrote a simple script.
from time import sleep
from grovepi import *
led = 5
pinMode(led, "OUTPUT")
sleep(1)
for i in range(2):
digitalWrite(led, 1)
print('ON')
sleep(1)
digitalWrite(led, 0)
print('OFF')
print('next..')
led = 22
pinMode(led, "OUTPUT")
sleep(1)
for i in range(2):
digitalWrite(led, 1)
print('ON')
sleep(1)
digitalWrite(led, 0)
print('OFF')
print('next..')
led = 24
pinMode(led, "OUTPUT")
sleep(1)
for i in range(2):
digitalWrite(led, 1)
print('ON')
sleep(1)
digitalWrite(led, 0)
print('OFF')
print('next..')
led = 25
pinMode(led, "OUTPUT")
sleep(1)
for i in range(2):
digitalWrite(led, 1)
print('ON')
sleep(1)
digitalWrite(led, 0)
print('OFF')
print(‘exiting...’)
- I ran this script with both
sudo python3 led.py
and justpython3 led.py
. The print messages are printed but nothing turns on. I tried changing the file ownership toroot
and ran it again but still doesn’t work.
I saw someone on the internet trying to run sudo i2cdetect -y 1
. Maybe this is something we need for debugging this problem. I ran this command and got:
pi@raspberrypi:~/Desktop $ sudo i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- 04 -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
Can anyone please help me out? I think my Grove Base Hat is not detected at all. I keep changing the values of led
to 5, 22 or 24, but not one led turns on… I will add some pictures!