Derkora / modul-raspberry-pi

0 stars 0 forks source link

fix GPIO #1

Open athallabf opened 2 weeks ago

athallabf commented 2 weeks ago
import RPi.GPIO as GPIO
from time import sleep

GPIO.setwarnings(False)  # Ignore warning for now
GPIO.setmode(GPIO.BCM)  # Use BCM GPIO pin numbering
GPIO.setup(14, GPIO.OUT)  # Set GPIO 18 as output

for i in range(5):
    GPIO.output(14, GPIO.HIGH)  # Turn on the LED
    sleep(1)  # Wait for 1 second
    GPIO.output(14, GPIO.LOW)  # Turn off the LED
    sleep(1)  # Wait for 1 second

GPIO.cleanup()  # Clean up GPIO settings
athallabf commented 2 weeks ago

isi /etc/apt/sources.list

deb http://raspbian.raspberrypi.org/raspbian/ bullseye main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
deb-src http://raspbian.raspberrypi.org/raspbian/ bullseye main contrib non-free rpi
athallabf commented 2 weeks ago

habis ganti sources.list run:

sudo apt update --allow-releaseinfo-change
athallabf commented 2 weeks ago

lupa harusnya update waktu dulu

sudo date -s "7 Nov 2024 14:42"

sesuain sama tanggal sekarang, trus baru

sudo apt update --allow-releaseinfo-change
athallabf commented 2 weeks ago

kode ultrasonic raspi: https://tutorials-raspberrypi.com/raspberry-pi-ultrasonic-sensor-hc-sr04/