Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d39abd3115 |
+12
-34
@@ -1,7 +1,7 @@
|
||||
// =============================================================================
|
||||
// Auth: alex
|
||||
// Auth: dodd
|
||||
// File: boot.go
|
||||
// Revn: 06-16-2026 2.0
|
||||
// Revn: 06-23-2022 0.1
|
||||
// Func: Blink a light when the pi boots (or on login, but who cares)
|
||||
//
|
||||
// TODO: create
|
||||
@@ -9,11 +9,6 @@
|
||||
// CHANGE LOG
|
||||
// -----------------------------------------------------------------------------
|
||||
// 06-23-2022: init
|
||||
//*10-10-2023: imported flag
|
||||
// added flag to define gpio pin at runtime
|
||||
//*06-16-2026: added flag to control flash duration
|
||||
// added flag to control amount of flashes
|
||||
// added flag to decide between flash mode and toggle mode
|
||||
//
|
||||
// =============================================================================
|
||||
|
||||
@@ -21,12 +16,10 @@ package main
|
||||
|
||||
|
||||
import (
|
||||
"flag" // IntVar, BoolVar, Float64Var, Parse
|
||||
"fmt" // Println
|
||||
// rpio.Pin, Pin, Open, Close, Output, Toggle
|
||||
"fmt"
|
||||
"github.com/stianeikeland/go-rpio"
|
||||
"os" // Exit
|
||||
"time" // Sleep, time.Second
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
||||
@@ -36,23 +29,13 @@ Connect a LED with resistor from pin 19 to ground.
|
||||
*/
|
||||
|
||||
|
||||
var pin rpio.Pin // global pin object
|
||||
var num int // flag variable, holds pin number
|
||||
var dur float64 // flag variable, holds duration
|
||||
var amt int // flag variable, holds times to flash
|
||||
var tog bool // flag variable, hold toggle mode switch
|
||||
// Use mcu pin 10, corresponds to physical pin 19 on the pi
|
||||
var pin rpio.Pin
|
||||
|
||||
|
||||
func main() {
|
||||
|
||||
// map input flag to variable
|
||||
flag.IntVar( &num, "p", 10, "pin number" )
|
||||
flag.Float64Var( &dur, "d", 100, "duration of flash (ms)" )
|
||||
flag.IntVar( &amt, "n", 2, "amount of times to flash" )
|
||||
flag.BoolVar( &tog, "t", false, "toggle mode" )
|
||||
flag.Parse()
|
||||
|
||||
// create pin object at given pin number
|
||||
pin = rpio.Pin( num )
|
||||
pin = rpio.Pin( 10 )
|
||||
// Open and map memory to access gpio, check for errors
|
||||
if err := rpio.Open(); err != nil {
|
||||
fmt.Println( "Fatal: pin open failed" )
|
||||
@@ -66,15 +49,10 @@ func main() {
|
||||
// Set pin to output mode
|
||||
pin.Output()
|
||||
|
||||
if tog { // if user specifies toggle mode
|
||||
pin.Toggle() // toggle
|
||||
return // and leave
|
||||
}
|
||||
|
||||
// Toggle pin 2*amt times
|
||||
for i := 0; i < 2 * amt; i++ {
|
||||
// Toggle pin 2 times
|
||||
for i := 0; i < 4; i++ {
|
||||
pin.Toggle()
|
||||
time.Sleep( time.Millisecond * time.Duration( dur ) )
|
||||
time.Sleep(time.Second / 10)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
# ==============================================================================
|
||||
# Auth: dodd
|
||||
# File: pi_id.sh
|
||||
# Revn: 01-04-2025 0.1
|
||||
# Func: ask user questions about new device
|
||||
#
|
||||
# TODO: bro figure out the ps1 thing
|
||||
# also like can i change the fucking hostname?
|
||||
# ==============================================================================
|
||||
# CHANGE LOG
|
||||
# ------------------------------------------------------------------------------
|
||||
# 01-04-2025: init
|
||||
#
|
||||
# ==============================================================================
|
||||
|
||||
|
||||
## ask for host name???
|
||||
# get user input
|
||||
# hostnamectl set-hostname $hstnm
|
||||
|
||||
# ask for username
|
||||
# change groupname from default to user input
|
||||
# get user input
|
||||
#
|
||||
|
||||
# ask for new password?
|
||||
# get user input
|
||||
# echo '$usr:$pwd' | sudo chpasswd
|
||||
|
||||
# ask about PS1????
|
||||
# dump PS1 case/esac into .bash_profile
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
# ==============================================================================
|
||||
# Auth: dodd
|
||||
# File: todo.txt
|
||||
# Revn: 01-08-2025 0.1
|
||||
# Func: todo
|
||||
#
|
||||
# TODO: create
|
||||
# ==============================================================================
|
||||
# CHANGE LOG
|
||||
# ------------------------------------------------------------------------------
|
||||
# 01-07-2025: init
|
||||
# 01-08-2025: remembered crontab exists
|
||||
#
|
||||
# ==============================================================================
|
||||
|
||||
|
||||
pi_id:: case/esac for PS1
|
||||
:: test current ( 01-07-2025 ) commands
|
||||
|
||||
pi_setup:: replace motd
|
||||
-> write down all places it's found
|
||||
-> keep copies of final files after adjustment
|
||||
-> look up better places to light LEDs and call ekho tbh
|
||||
-> I don't think .bashrc is the right place to do those
|
||||
things
|
||||
-> crontab
|
||||
|
||||
Reference in New Issue
Block a user