Simple log function with date/time prefix
1 2 3 4 5 | const log = function(data) { var dateTime = '[' + new Date().toUTCString() + '] '; console.log(dateTime, data); }; |
Simple log function with date/time prefix
1 2 3 4 5 | const log = function(data) { var dateTime = '[' + new Date().toUTCString() + '] '; console.log(dateTime, data); }; |
package main
import (
"machine"
"time"
// "fmt"
)
const led = machine.LED
func main() {
// fmt.Println("Test")
println("Hello, TinyGo")
led.Configure(machine.PinConfig{Mode: machine.PinOutput})
for {
led.Low()
time.Sleep(time.Second)
led.High()
time.Sleep(time.Second)
}
}
* fmt is not supported, cannot be used.docker run --rm -v $(pwd):/src tinygo/tinygo:0.9.0 tinygo build -o /src/test1.hex -size=short -target=arduino /src/tinygo/tinygo1.go* The source is in $(pwd)/tinygo/tinygo1.go
/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -v -patmega328p -carduino -P/dev/cu.usbserial-1440 -b115200 -D -Uflash:w:$(pwd)/tinygo/test1.hex:i* I got command from Arduino IDE, by enabling verbose mode for upload and run a sample upload