Search found 23 matches

by misaalanshori
Thu Nov 21, 2019 11:00 pm
Forum: Programs, Libraries and Tools
Topic: Can't get my NeoPixels to turn on
Replies: 6
Views: 95

Re: Can't get my NeoPixels to turn on

How do I fix the timing problems? do i have to change the cpu frequency?
by misaalanshori
Thu Nov 21, 2019 1:53 pm
Forum: Programs, Libraries and Tools
Topic: Can't get my NeoPixels to turn on
Replies: 6
Views: 95

Re: Can't get my NeoPixels to turn on

so I found a neopixel Arduino library that works with an esp32 and it works first time, with 5v, on gpio pin 5... so it shouldn't be hardware related...
I still want to get this to work with micropython so what other troubleshooting steps should I do next?
by misaalanshori
Wed Nov 20, 2019 10:42 pm
Forum: Programs, Libraries and Tools
Topic: Can't get my NeoPixels to turn on
Replies: 6
Views: 95

Re: Can't get my NeoPixels to turn on

I don't think I have anything that can output 4v, but a tutorial that I was following said that I should be able to just connect 5v to the led board directly and a GPIO pin to the DIN... maybe I should try to upload an Arduino example code to the board to make sure that the led board is not defective?
by misaalanshori
Wed Nov 20, 2019 3:16 pm
Forum: Programs, Libraries and Tools
Topic: Can't get my NeoPixels to turn on
Replies: 6
Views: 95

Can't get my NeoPixels to turn on

I have a WS2812 Neopixel stick with 8 leds, I connected the "DIN" to GPIO5, but i can't get it to light up at all. Im not sure if its my code, the led board, the esp board that is causing it Heres the code: import machine, neopixel pin = machine.Pin(5) np = neopixel.NeoPixel(pin, 8) np[0] = (255, 0,...
by misaalanshori
Tue Nov 12, 2019 1:16 pm
Forum: General Discussion and Questions
Topic: A way to detect button press?
Replies: 5
Views: 154

Re: A way to detect button press?

Thank you so much, everything works as expected now!
by misaalanshori
Tue Nov 12, 2019 1:13 pm
Forum: General Discussion and Questions
Topic: A way to detect button press?
Replies: 5
Views: 154

Re: A way to detect button press?

Ohh, thanks for the explanation!! this has confused me for way too long, I just expected it to just be able to modify a global variable because I can read it so why couldn't I modify it...
by misaalanshori
Tue Nov 12, 2019 1:09 pm
Forum: General Discussion and Questions
Topic: A way to detect button press?
Replies: 5
Views: 154

Re: A way to detect button press?

This Code works (i had to invert the 1 and 0 but that shouldnt be the cause): from machine import Pin import time button = Pin(0, Pin.IN) def buttonPress(num): temp = num if (temp == 1) & (button.value() == 0): return 1 elif (temp == 0) & (button.value() == 0): return 2 elif (temp == 0) & (button.va...
by misaalanshori
Tue Nov 12, 2019 12:53 pm
Forum: General Discussion and Questions
Topic: A way to detect button press?
Replies: 5
Views: 154

Re: A way to detect button press?

its been like 1 hour since i have this problem and I still can't seem to figure it out. It feel like its such a simple mistake but i just can't solve it. I even made another file and created a simple function that uses a variable from outside of the function and it works perfectly...
by misaalanshori
Tue Nov 12, 2019 11:25 am
Forum: General Discussion and Questions
Topic: A way to detect button press?
Replies: 5
Views: 154

A way to detect button press?

Currently i have this code, but Im getting "NameError: local variable referenced before assignment" from line 6 about the "lastState" variable even though I already created the variable with value 0 before I call the function from machine import Pin button = Pin(0, Pin.IN) lastState = 0 #Variable cr...
by misaalanshori
Tue Nov 12, 2019 4:10 am
Forum: General Discussion and Questions
Topic: How do i fix "OSError: [Errno 110] ETIMEDOUT" on this code?
Replies: 3
Views: 169

Re: How do i fix "OSError: [Errno 110] ETIMEDOUT" on this code?

Yes, the error happens when its trying to sync the time. So my solution was to put the syncing code in a "try:" and put "continue" in the "except:" so it just continues the loop and just tries again instead of stopping the program. There's probably a better solution but for now its good enough for m...