This commit is contained in:
2022-06-27 12:59:58 -04:00
parent 580b3d68ae
commit e180cd8ea8
31 changed files with 2045 additions and 7 deletions
+55
View File
@@ -0,0 +1,55 @@
// =============================================================================
// Auth: Alex Celani
// File: boot.go
// Revn: 06-23-2022 0.1
// Func: Blink a light when the pi boots (or on login, but who cares)
//
// TODO: create
// =============================================================================
// CHANGE LOG
// -----------------------------------------------------------------------------
// 06-23-2022: init
//
// =============================================================================
package main
import (
"github.com/stianeikeland/go-rpio"
"os"
"time"
)
/*
Toggles a LED on physical pin 19 (mcu pin 10)
Connect a LED with resistor from pin 19 to ground.
*/
// Use mcu pin 10, corresponds to physical pin 19 on the pi
var pin rpio.Pin
func main() {
pin = rpio.Pin( 10 )
// Open and map memory to access gpio, check for errors
if err := rpio.Open(); err != nil {
os.Exit(1)
}
// Unmap gpio memory when done
defer rpio.Close()
// Set pin to output mode
pin.Output()
// Toggle pin 20 times
for i := 0; i < 4; i++ {
pin.Toggle()
time.Sleep(time.Second / 10)
}
}