projects:commerce_st

  • change parameters for stepper motor (read by pinPulse.sh)
sshpass -p yourpassword ssh debian@beaglebone.local "echo 0.5 > /home/debian/pulse_on"
sshpass -p yourpassword ssh debian@beaglebone.local "echo 2 > /home/debian/pulse_off"
  • LED strip test
import socket, struct, time, sys
ipAddr = sys.argv[1]
NUM_PIXELS = 16
 
pixels = bytes([255, 0, 0] * NUM_PIXELS) # RED
header = struct.pack('>BBH', 0, 0, len(pixels))
packet = header + pixels
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.sendto(packet, (ipAddr, 7891))
time.sleep(0.05)
s.sendto(packet, (ipAddr, 7891))
  • led strip fade test
import socket, struct, time, math, sys
ipAddr = sys.argv[1]
 
NUM_PIXELS = 16
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
 
# Prime the buffer
pixels = bytes([255, 0, 0] * NUM_PIXELS)
header = struct.pack('>BBH', 0, 0, len(pixels))
s.sendto(header + pixels, (ipAddr, 7891))
time.sleep(0.05)
 
# Now update continuously
i = 0
while True:
    r = int((math.sin(i * 0.05) + 1) * 127)
    pixels = bytes([r, 0, 0] * NUM_PIXELS)
    header = struct.pack('>BBH', 0, 0, len(pixels))
    s.sendto(header + pixels, (ipAddr, 7891))
    time.sleep(0.033)
    i += 1
  • change # of LEDs in strip by editing /etc/ledscape-config.json
  • flash sdcard to emmc
    • optional: make sure the sdcard is healthy. When not mounted (example): sudo fsck.ext4 -f /dev/sda1
    • boot BB from sdcard then: sudo /opt/scripts/tools/eMMC/bbb-eMMC-flasher-eewiki-ext4.sh

BBB issues

  • jack is failing overnight. There was a solution built into the whisphering woodlands project I think?
    • the solution is to set up a cronjob that runs every 5 minutes and reboots the BB if jack fails: restartIfJackIsJacked.sh
#!/bin/bash
process="jackd"
 
cpuUsage=$(top -bn2 -p $(pgrep $process) | grep $process | tail -n 1 | awk {'print $9;'} | cut -f1 -d'.')
# echo $cpuUsage
if [ "$cpuUsage" -gt "80" ]; then
        echo "PUTPASSWORDHEREYESIKNOWTHISISNOTSECURE" | sudo -S reboot
fi
  • projects/commerce_st.txt
  • Last modified: 2026/06/29 22:04
  • by John Harrison