PREVENTING RASPBERRY PI WIFI FROM GOING INTO SLEEP MODE
sudo nano /etc/modprobe.d/8192cu.conf
# Disable power management
options 8192cu rtw_power_mgnt=0
difference between /etc/rc.local and /etc/init.d/rc.local
/etc/init.d/rc.local
:
makes it to start as a level "service"
whereas,/etc/rc.local
would simply launch that script
at boot time.
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
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.