Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| projects:commerce_st [2025/03/05 14:20] – John Harrison | projects:commerce_st [2026/06/29 22:04] (current) – John Harrison | ||
|---|---|---|---|
| Line 2: | Line 2: | ||
| * [[https:// | * [[https:// | ||
| * licensed under [[https:// | * licensed under [[https:// | ||
| + | |||
| + | ==== Controlling Beaglebone Black ==== | ||
| + | * change parameters for stepper motor (read by '' | ||
| + | <code bash> | ||
| + | sshpass -p yourpassword ssh debian@beaglebone.local "echo 0.5 > / | ||
| + | sshpass -p yourpassword ssh debian@beaglebone.local "echo 2 > / | ||
| + | </ | ||
| + | * LED strip test | ||
| + | <code python> | ||
| + | import socket, struct, time, sys | ||
| + | ipAddr = sys.argv[1] | ||
| + | NUM_PIXELS = 16 | ||
| + | |||
| + | pixels = bytes([255, 0, 0] * NUM_PIXELS) # RED | ||
| + | header = struct.pack('> | ||
| + | packet = header + pixels | ||
| + | s = socket.socket(socket.AF_INET, | ||
| + | s.sendto(packet, | ||
| + | time.sleep(0.05) | ||
| + | s.sendto(packet, | ||
| + | </ | ||
| + | * led strip fade test | ||
| + | <code python> | ||
| + | import socket, struct, time, math, sys | ||
| + | ipAddr = sys.argv[1] | ||
| + | |||
| + | NUM_PIXELS = 16 | ||
| + | s = socket.socket(socket.AF_INET, | ||
| + | |||
| + | # Prime the buffer | ||
| + | pixels = bytes([255, 0, 0] * NUM_PIXELS) | ||
| + | header = struct.pack('> | ||
| + | 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('> | ||
| + | s.sendto(header + pixels, (ipAddr, 7891)) | ||
| + | time.sleep(0.033) | ||
| + | i += 1 | ||
| + | </ | ||
| + | ==== BBB config ==== | ||
| + | * change # of LEDs in strip by editing ''/ | ||
| + | * flash sdcard to emmc | ||
| + | * optional: make sure the sdcard is healthy. When **not** mounted (example): '' | ||
| + | * boot BB from sdcard then: '' | ||
| + | |||
| + | === 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: '' | ||
| + | <code bash> | ||
| + | #!/bin/bash | ||
| + | process=" | ||
| + | |||
| + | cpuUsage=$(top -bn2 -p $(pgrep $process) | grep $process | tail -n 1 | awk {' | ||
| + | # echo $cpuUsage | ||
| + | if [ " | ||
| + | echo " | ||
| + | fi | ||
| + | </ | ||