I'm trying to connect separate RGB Led to my board. I use ports 7,9 and 11 for R,G and B colors. At the beginning I checked this led with multimeter and all works well, the Led is not broken. Then I soldered GND port to my led and red color via resistor (capacity 220). And used such sample:
import machine
import time
led = machine.Pin(7, machine.Pin.OUT)
while True:
led.value(1)
time.sleep_ms(100)
led.value(0)
time.sleep_ms(500)
led.value(1)
time.sleep_ms(100)
led.value(0)
time.sleep_ms(200)
led.value(1)
time.sleep_ms(100)
led.value(0)
and nothing works I thought maybe I have to use 3.3V port instead, but also does not work. I thought that maybe I overheated led, but multimeter broke this hypothesis. I'm little bit confused, because I tried both variants of power and none of them works, that is little bit strange.
Thanks for posting the code properly. Looking at the schematic you did not post I will take a SWAG and say the LEDs have the opposite polarity then what you are wiring for.
Thank you for your reply, I don't know how it's works, but I returned C++ bootloader. And then with similar sketch all works well. The polarity is ok, I checked it several times. I'm little bit confused that microPython can not support full functionality of C++ in context of development. Maybe you have some ideas why does it happen?
The code in my question and the arduino on the moment of this question creation was written in python, then I returned back C++ bootloader and tried C++ sketch which worked well not like python sketch what I can not understand
Your C++ and Python sketches are not quite the same. Your Python code changes only one pin (7) where the C++ code changes 3 pins (7, 9, 11). Also the timing is different, in the C++ code, all the delays are 1000ms but in the Python code they are different lengths and some are only a brief flash.
Are you sure you connected the led to the correct pin when running the Python code?
Pins are correct, I agree that these sketches are not the same, but general logic I think you will agree that work with pins. I can do similar like python on C++ but it will work not as with python. It's not very obvious for me why...