/ firmware / main.go
main.go
 1  package main
 2  
 3  // https://github.com/tinygo-org/tinygo/blob/release/src/machine/machine_esp32s3.go
 4  // https://tinygo.org/docs/reference/microcontrollers/machine/esp32-mini32/
 5  
 6  // tinygo env
 7  // tinygo ports
 8  // tinygo flash -target=esp32s3 -port=/dev/ttyUSB0
 9  // tinygo monitor -port=/dev/ttyUSB0
10  
11  import (
12  	"machine"
13  	"time"
14  )
15  
16  func main() {
17  	println("Hello World from TinyGo! 👋")
18  
19  	count := 0
20  	led := machine.GPIO38
21  	led.Configure(machine.PinConfig{Mode: machine.PinOutput})
22  
23  	println("CPU Frequency is: ")
24  	print(machine.GetCPUFrequency())
25  
26  	for {
27  		println("count:", count)
28  		count++
29  
30  		led.Low()
31  		println("LED IS:", led.Get())
32  		time.Sleep(time.Second / 2)
33  
34  		led.High()
35  		println("LED IS:", led.Get())
36  		time.Sleep(time.Second / 2)
37  	}
38  }