Skip to content

Undefined SCL and SDA PINs for ESP32 #4779

@IngwiePhoenix

Description

@IngwiePhoenix

I just wanted to flash a very basic program to an ESP32 and got this error:

PS C:\Users\ingwi\Work\esp32-test> tinygo flash -target=esp32 ./main.go
# machine
C:\Users\ingwi\tinygo\src\machine\machine_esp32_i2c.go:38:16: undefined: SCL_PIN
C:\Users\ingwi\tinygo\src\machine\machine_esp32_i2c.go:41:16: undefined: SDA_PIN

I clearned out the tonygo folder before upgrading.

PS C:\Users\ingwi\Work\esp32-test> tinygo version
tinygo version 0.36.0 windows/amd64 (using go version go1.24.0 and LLVM version 19.1.2)
PS C:\Users\ingwi\Work\esp32-test> go version
go version go1.24.0 windows/amd64

Here is the main.go that I tried to compile:

package main

import (
        "machine"
        "time"
)

var counter int

func handleInterrupt(machine.Interrupt) {
        counter++
}

func main() {
        button := machine.GPIO4 // Change to your desired pin
        button.Configure(machine.PinConfig{Mode: machine.PinInputPullup})

        interrupt := machine.NewInterrupt(button, machine.PinFalling, handleInterrupt)
        interrupt.Enable()

        for {
                println("Counter:", counter)
                time.Sleep(time.Second)
        }
}

The same also happens when I try to use an existing example:

PS C:\Users\ingwi\Work\esp32-test> tinygo flash -target=esp32 examples/blinky1
# machine
C:\Users\ingwi\tinygo\src\machine\machine_esp32_i2c.go:38:16: undefined: SCL_PIN
C:\Users\ingwi\tinygo\src\machine\machine_esp32_i2c.go:41:16: undefined: SDA_PIN

Did I miss anything...?

Metadata

Metadata

Assignees

No one assigned

    Labels

    esp32questionQuestion about usage of TinyGo

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions