Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 40 additions & 4 deletions root/scripts/n247launch/launch.pre
Original file line number Diff line number Diff line change
@@ -1,5 +1,41 @@
#!/usr/bin/bash
clear
#fbv -f -e -d 1 /root/.lemonlauncher/loadingen.png > /dev/null 2>&1
#fbv -f -e /root/.lemonlauncher/loadingen.png > /dev/null 2>&1
# -r ignores aspect
# Based on https://github.com/simonprickett/bash-traffic-lights-pi/blob/master/trafficlights.sh
# This script will send a signal to a relay switch that passes machine ready to credit board that tells the coin mech to accept coins

BASE_GPIO_PATH=/sys/class/gpio

# Assign names to GPIO pin numbers
COIN=27

# Assign names to states
WAIT="1"
READY="0"

# Utility function to export a pin if not already exported
exportPin()
{
if [ ! -e $BASE_GPIO_PATH/gpio$1 ]; then
echo "$1" > $BASE_GPIO_PATH/export
fi
}

# Utility function to set a pin as an output
setOutput()
{
echo "out" > $BASE_GPIO_PATH/gpio$1/direction
}

# Utility function to change state
setState()
{
echo $2 > $BASE_GPIO_PATH/gpio$1/value
}

# Export pins so that we can use them
exportPin $COIN

# Set pins as outputs
setOutput $COIN

# Set state
setState $COIN $READY
1 change: 1 addition & 0 deletions root/scripts/n247launch/launch.pst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
setState $COIN $WAIT