raspberrypi

Get a BananaPi,RaspberryPi

# 좌: 라즈베리파이 , 우: 바나나파이 !!

- 앞으로 재미난 프로젝트 할 거리가 많아졌다.

AutoStart Script Best-Simple Tips

Everything in /etc/rc.local runs as the root user.

Also, you can group commands together using ().

The following should work in /etc/rc.local

(sleep 10;python scriptname.py)&

Raspberry Pi GPIO Pins Tutorial

The best way to execute this code is using a callback function. This is a function that is attached to a specific GPIO pin and run whenever that edge is detected. Let’s try one:

import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BCM)

GPIO.setup(23, GPIO.IN, pull_up_down = GPIO.PUD_DOWN)

GPIO.setup(24, GPIO.IN, pull_up_down = GPIO.PUD_UP)

def printFunction(channel):

    print(“Button 1 pressed!”)

    print(“Note how the bouncetime affects the button press”)

GPIO.add_event_detect(23, GPIO.RISING, callback=printFunction, bouncetime=300)

while True:

    GPIO.wait_for_edge(24, GPIO.FALLING)

    print(“Button 2 Pressed”)

    GPIO.wait_for_edge(24, GPIO.RISING)

    print(“Button 2 Released”)

GPIO.cleanup()

Turn the display back on/off on Raspberry Pi

Start by getting access to the GPIO by making a device link
sudo sh -c  "echo 252 > /sys/class/gpio/export"
ls -l /sys/class/gpio

Then turn the display back on with

sudo sh -c  "echo '1' > /sys/class/gpio/gpio252/value"

or back off
sudo sh -c  "echo '0' > /sys/class/gpio/gpio252/value"

Install Node on The Raspberry Pi in 5minutes

Installing Node on a Raspberry PI used to be a whole lot of pain. Compiling an codebase that big on the Pi really taxes the system, plus the usual dependency challenges of native C code. Fortunately, the good chaps at nodejs.org have started automatically building Node for Linux arm Raspberry Pi. This makes life so much easier. Now we can install node in less that five minutes. Here’s how.