Quantcast
Channel: tcpmeta – The IT Garage
Viewing all articles
Browse latest Browse all 90

Electronics Part Finder – Trying some things

$
0
0

So I started playing around with some bash scripting and got an idea. Using case statements I can search for my part and it will output where it is and run a curl command to the WLED controller.

#!/bin/bash

echo -e "\e[32m PART FINDER \e[0m"

sleep 2s

case ${1,,} in
        resistor-1k)
                echo -e "\e[36m Cabinet 1 Drawer 1.\e[0m"
                sh cabinet1/drawer1.sh
                ;;
        resistor-3k3)
                echo -e "\e[36m Cabinet 1 Drawer 2.\e[0m"
                ;;
        resistor-4k7)
                echo -e "\e[36m cabinet 1 Drawer 2.\e[0m"
                ;;
esac

read -p "Press ENTER to continue"

Using some ANSI codes to get some color and just playing around with cabinet 1 drawer 1 for now. It’s been a while since I played with bash scripts. The script drawer1 just outputs a echo for the moment. Tomorrow I’ll dig out a ESP8266 and flash WLED on it and pull the addressable LEDs off the rack and play around with that then I can incorporate it into the script.

Debating to run this from a Omega2 system on a chip so I can use any system with SSH on my network to interact with it.

The hard part for me is getting WLED to do my bidding. Reading the instructions for the API is a little different then what I am use to.


Viewing all articles
Browse latest Browse all 90

Trending Articles