tinygo.org/x/drivers@v0.27.1-0.20240509133757-7dbca2a54349/examples/net/snake/init.go (about)

     1  //go:build ninafw || wioterminal
     2  
     3  package main
     4  
     5  import (
     6  	"log"
     7  	"time"
     8  
     9  	"tinygo.org/x/drivers/netlink"
    10  	"tinygo.org/x/drivers/netlink/probe"
    11  )
    12  
    13  var (
    14  	ssid string
    15  	pass string
    16  )
    17  
    18  func init() {
    19  	time.Sleep(2 * time.Second)
    20  
    21  	link, _ := probe.Probe()
    22  
    23  	err := link.NetConnect(&netlink.ConnectParams{
    24  		Ssid:       ssid,
    25  		Passphrase: pass,
    26  	})
    27  	if err != nil {
    28  		log.Fatal(err)
    29  	}
    30  }