Ini Ceritaku Mana Ceritamu, Linux, Opensource, python, RaspberryProject

Lampu kelap-kelip ala Pi.

Tadi di kampus ngoprek si Pai biar bisa kedip” gitu, Awal nya dari aksi Show ON nya @muhammadseptyan yang dengan keren nya bikin led yang nyambung ke GPIO Pai bisa nyala dengan program python (BUKAN ULER GAN!).

Awal nya ide gw, gimana tu LED bisa kedap-kedip. alhasil di coba lah. googling sana sini, gak dapet. hahaha, betapa idiot nya gw. padahal punya ebook “Getting Started With Raspberrypi O’relly” . Akhir nya buka tu ebook. ternyata ada di Chapter 8.

import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(25, GPIO.OUT)
while True:
GPIO.output(25, GPIO.HIGH)
time.sleep(1)
GPIO.output(25, GPIO.LOW)
time.sleep(1)

diatas itu kodingan nya. Gw masih belum paham dengan penjelasan nya. Maklum baru banget terjun ke embeded (padahal gw anak Sistem Komputer :-p )

gw sempet liat di hp nya –> @muhammadseptyan ada datasheet dari port GPIO yang bentuk nya kayak gini.

P1 Header Pinout, top row:

Pin Number Pin Name Rev1 Pin Name Rev2 Hardware Notes Alt 0 Function Other Alternative Functions
P1-02 5V0 Supply through input poly fuse
P1-04 5V0 Supply through input poly fuse
P1-06 GND
P1-08 GPIO 14 Boot to Alt 0 -> UART0_TXD ALT5 = UART1_TXD
P1-10 GPIO 15 Boot to Alt 0 -> UART0_RXD ALT5 = UART1_RXD
P1-12 GPIO 18 PCM_CLK ALT4 = SPI1_CE0_N ALT5 = PWM0
P1-14 GND
P1-16 GPIO23 ALT3 = SD1_CMD ALT4 = ARM_RTCK
P1-18 GPIO24 ALT3 = SD1_DAT0 ALT4 = ARM_TDO
P1-20 GND
P1-22 GPIO25 ALT3 = SD1_DAT1 ALT4 = ARM_TCK
P1-24 GPIO08 SPI0_CE0_N
P1-26 GPIO07 SPI0_CE1_N

P1 Header Pinout, bottom row:

Pin Number Pin Name Rev1 Pin Name Rev2 Hardware Notes Alt 0 Function Other Alternative Functions
P1-01 3.3 V 50 mA max (01 & 17)
P1-03 GPIO 0 GPIO 2 1K8 pull up resistor I2C0_SDA / I2C1_SDA
P1-05 GPIO 1 GPIO 3 1K8 pull up resistor I2C0_SCL / I2C1_SCL
P1-07 GPIO 4 GPCLK0 ALT5 = ARM_TDI
P1-09 GND
P1-11 GPIO17 ALT3 = UART0_RTS ALT4 = SPI1_CE1_N ALT5 = UART1_RTS
P1-13 GPIO21 GPIO27 PCM_DOUT / reserved ALT4 = SPI1_SCLK ALT5 = GPCLK1 / ALT3 = SD1_DAT3 ALT4 = ARM_TMS
P1-15 GPIO22 ALT3 = SD1_CLK ALT4 = ARM_TRST
P1-17 3.3 V 50 mA max (01 & 17)
P1-19 GPIO10 SPI0_MOSI
P1-21 GPIO9 SPI0_MISO
P1-23 GPIO11 SPI0_SCLK
P1-25 GND

source: http://elinux.org/RPi_Low-level_peripherals

Colour legend
+5 V
+3.3 V
Ground, 0V
UART
GPIO
SPI
I²C
Standard

One thought on “Lampu kelap-kelip ala Pi.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s