Linux startup script

Create script in /etc/init.d sudo nano /etc/init.d/NameOfYourScript The following is an example based on starting up the no-ip service [/usr/local/bin/noip], but change the name of the script and the command to start and stop it and it would work for any command. #! /bin/sh # /etc/init.d/noip### BEGIN INIT INFO # Provides:          noip # Required-Start:    $remote_fs… Continue reading Linux startup script

XFCE4 Vnc Linux

#!/bin/sh unset SESSION_MANAGER unset DBUS_SESSION_BUS_ADDRESS startxfce4 &

Control Arduino from Raspberry Pi with pyFirmata

Requirements Raspberry Pi with Raspbian OS installed in it Arduino Uno or any other Arduino board Arduino USB cable LED   Installing PyFirmata in Arduino using Raspberry Pi To upload PyFirmata firmware in Arduino, we have to install Arduino IDE in Raspberry Pi. Follow these steps to install: Step 1:- Connect the Raspberry Pi to… Continue reading Control Arduino from Raspberry Pi with pyFirmata

Raspberry turn off usb ports

download this https://github.com/codazoda/hub-ctrl.c You can control the power on a port using the following command. (I installed it in user bin directory) sudo $HOME/bin/hub-ctrl -h 1 -P 2 -p 1 That says to control hub 3 (-h 3) port 1 (-P 1) and to turn the power off (-p 0). You can also use ”-p… Continue reading Raspberry turn off usb ports

Raspberry: upload Arduino sketch from CLI

install these packages sudo apt-get install arduino-core arduino-mk Then add yourself to the dialout group to allow you to upload code to the Arduino board sudo usermod -a -G dialout pi (Change pi to be your username if different) Create Makefile ARDUINO_DIR = /usr/share/arduino BOARD_TAG = uno ARDUINO_PORT = /dev/ttyACM* ARDUINO_LIBS = include /usr/share/arduino/Arduino.mk to… Continue reading Raspberry: upload Arduino sketch from CLI

Crontab on Linux

To launch a program at reboot. contab -e Add following line to crontab file: @reboot sudo python /home/pi/hw-home.py /home/pi/hw-home.txt