Skip to content
Browse files

Activate I2C on RPi

  • Loading branch information...
NEMS Linux
NEMS Linux committed Feb 25, 2019
1 parent 4641311 commit cafe8f9aa133dc68c82e60ed7ecf381ea2b90593
Showing with 15 additions and 0 deletions.
  1. +15 −0 build/160-rpi-piwatcher
@@ -5,6 +5,21 @@ platform=$(/usr/local/bin/nems-info platform)

if [[ $platform < 10 ]]; then
printf "Installing support for PiWatcher hardware... "

# enable I2C
apt install -y python-smbus
apt install -y i2c-tools
if ! grep -q "i2c-dev" /etc/modules; then
echo 'i2c-dev' >> /etc/modules
if grep -q "#dtparam=i2c_arm=on" /boot/config.txt; then
/bin/sed -i -- 's,#dtparam=i2c_arm=on,dtparam=i2c_arm=on,g' /boot/config.txt
# In case it wasn't commented in the file previously, so still does not exist
if ! grep -q "dtparam=i2c_arm=on" /boot/config.txt; then
echo 'dtparam=i2c_arm=on' >> /boot/config.txt

cd /tmp
git clone
cd piwatcher

0 comments on commit cafe8f9

Please sign in to comment.
You can’t perform that action at this time.