Mausberry Switch Script

Raspberry Pi related support

Mausberry Switch Script

Postby thedman! » 08 Apr 2016, 16:39

Hi Chaps,

I'm trying to install a mausberry switch. Its physicaly connected properly...

The instructions to install are:

For Arch:

1. wget http://files.mausberrycircuits.com/setupArch.sh
2. bash setupArch.sh
3. reboot

1. is fine
2. gives the error:

The unit files have no [Install] section. They are not meant to be enabled
using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
.wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
D-Bus, udev, scripted systemctl call, ...).

Has anyone got any idea how I should get the script installed given this???

Cheers,

Dave.
thedman!
 
Posts: 62
Joined: 24 Mar 2016, 15:45

Re: Mausberry Switch Script

Postby thedman! » 08 Apr 2016, 18:44

The script of the setup file is:

echo '#!/bin/bash

#this is the GPIO pin connected to the lead on switch labeled OUT
GPIOpin1=23

#this is the GPIO pin connected to the lead on switch labeled IN
GPIOpin2=24

echo "$GPIOpin1" > /sys/class/gpio/export
echo "in" > /sys/class/gpio/gpio$GPIOpin1/direction
echo "$GPIOpin2" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio$GPIOpin2/direction
echo "1" > /sys/class/gpio/gpio$GPIOpin2/value
while [ 1 = 1 ]; do
power=$(cat /sys/class/gpio/gpio$GPIOpin1/value)
if [ $power = 0 ]; then
sleep 1
else
poweroff
fi
done' > /etc/switch.sh
chmod 777 /etc/switch.sh
echo '[Unit]
Description=MausBerry

[Service]
ExecStart=/bin/bash /etc/switch.sh

[Install]
WantedBy=multi-user.target' > /etc/systemd/mausberry.service
systemctl enable /etc/systemd/mausberry.service
thedman!
 
Posts: 62
Joined: 24 Mar 2016, 15:45

Re: Mausberry Switch Script

Postby PeteB » 08 Apr 2016, 19:08

PeteB
 
Posts: 421
Joined: 06 Feb 2016, 05:07

Re: Mausberry Switch Script

Postby thedman! » 08 Apr 2016, 19:32

Hi Pete,

Thanks for your help. Yes I was logged in a root, i've tried twice since, still get the same message

Dave
thedman!
 
Posts: 62
Joined: 24 Mar 2016, 15:45

Re: Mausberry Switch Script

Postby PeteB » 08 Apr 2016, 19:49

PeteB
 
Posts: 421
Joined: 06 Feb 2016, 05:07

Re: Mausberry Switch Script

Postby hondagx35 » 08 Apr 2016, 20:27

User avatar
hondagx35
 
Posts: 3042
Joined: 11 Sep 2014, 22:06
Location: Germany

Re: Mausberry Switch Script

Postby thedman! » 09 Apr 2016, 07:54

thedman!
 
Posts: 62
Joined: 24 Mar 2016, 15:45

Re: Mausberry Switch Script

Postby hondagx35 » 09 Apr 2016, 10:08

User avatar
hondagx35
 
Posts: 3042
Joined: 11 Sep 2014, 22:06
Location: Germany

Re: Mausberry Switch Script

Postby thedman! » 10 Apr 2016, 09:09

Wow! The script has installed properly now and the pi shutdown when pressed so thanks a million for your help people. However it started straight back up again, TBH I expected that, as it is a momentary switch. So I'll experiment with a different switch. However, I've trashed a jumper cable and the switch does nothing at the moment :roll:
thedman!
 
Posts: 62
Joined: 24 Mar 2016, 15:45

Re: Mausberry Switch Script

Postby thedman! » 12 Apr 2016, 23:06

thedman!
 
Posts: 62
Joined: 24 Mar 2016, 15:45

support RuneAudio Donate with PayPal

Next

Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 17 guests
cron