You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to interface an OLED display with an Arduino Nano through the TinyGo library. I've managed to flash the code below to my Nano multiple times however there isn't any response through the OLED display.
I'm certain I've setup the wiring correctly as I run some code through the Arduino IDE and the OLED display works as expected with the same wiring.
It would be great if anyone can help with this - I've researched various websites and I believe this could just be a configuration issue with TinyGo's SSD1306 module but I'm not sure about the fix.
My current code:
package main
import (
"image/color"
"machine"
"time"
"tinygo.org/x/drivers/ssd1306"
)
func main() {
// Initialize I2C (using the default pins for Arduino Nano)
i2c := machine.I2C0
i2c.Configure(machine.I2CConfig{})
// Initialize the OLED display with SSD1306 driver
display := ssd1306.NewI2C(i2c)
display.Configure(ssd1306.Config{
Width: 128,
Height: 64,
Address: 0x3C, // Default I2C address for OLED
})
// Clear the display buffer
display.ClearBuffer()
// Turn on all the pixels by setting each one to 1 (on)
for x := int16(0); x < 128; x++ {
for y := int16(0); y < 64; y++ {
display.SetPixel(x, y, color.RGBA{255, 255, 255, 255}) // Set each pixel to "white"
}
}
// Send buffer to the display to update it
display.Display()
// Keep the display on
for {
time.Sleep(time.Second)
}
}
I'm also using the Arduino Nano ATmega328P. I've tested the other pins with external LEDs and I'm certain they are working as well.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm trying to interface an OLED display with an Arduino Nano through the TinyGo library. I've managed to flash the code below to my Nano multiple times however there isn't any response through the OLED display.
I'm certain I've setup the wiring correctly as I run some code through the Arduino IDE and the OLED display works as expected with the same wiring.
It would be great if anyone can help with this - I've researched various websites and I believe this could just be a configuration issue with TinyGo's SSD1306 module but I'm not sure about the fix.
My current code:
I'm also using the Arduino Nano ATmega328P. I've tested the other pins with external LEDs and I'm certain they are working as well.
Beta Was this translation helpful? Give feedback.
All reactions