Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4824

Troubleshooting • Re: HC05 and i2c working at the same time

$
0
0

Code:

# I2C Scanner MicroPythonfrom machine import Pin, SoftI2C, UARTimport ssd1306import time# You can choose any other combination of I2C pinsi2c = SoftI2C(scl=Pin(0), sda=Pin(1))uart1 = UART(1, baudrate=9600, tx=Pin(4), rx=Pin(5))oled_width = 128oled_height = 32oled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2c)oled.fill(1)oled.text('BOX OS STARTING...', 0, 12, 0)oled.show()time.sleep(3)oled.fill(0)oled.show()time.sleep(3)oled.fill(1)oled.text('WECOME TO BOX OS', 0, 1, 0)oled.text('1.waiting...', 0, 13, 0)oled.show()while True:    if uart1.any():        data = uart1.read()        print(data)        print(uart1.any())        oled.text('connected', 0, 13, 0)        oled.show()        oleddata = str(data)        oled.text(oleddata, 0, 13, 0)        oled.show()    
If you're going to post python code on here you need to enclose it in [code][/code] tags. If you don't your program gets scrambled. I've fixed what you posted in the quoted section above.

Statistics: Posted by DougieLawson — Mon Dec 23, 2024 2:48 pm



Viewing all articles
Browse latest Browse all 4824

Trending Articles