I have a raspberry pi 3 model B and a Kano LED light ring
my kid stopped using the raspberry pi and i repurposed it to make a pihole, it doesn't have the KanoOS anymore and just has the regular raspbian OS running my DNS server.
The lights on the LED were always on really bright (white only), and I wanted to learn how to change the colors. I used the code below, which when I ran the program it turned the lights off but won't turn them back on. If I restart the pi, it will turn them back on. If I rerun the code it turns them all off again. Anyone have any ideas on how to trouble shoot this?
import board
import neopixel
pixels = neopixel.NeoPixel(board.D18, 10, brightness=0.3, auto_write=False)
pixels[0] = (255, 0 , 0)
pixels.show()
Thanks again for any help.
I am using a rapberry pi pico to read the temprature from a k-type thermocouple. in the code, I added a while loop, but no way to break it, and I also named it main.py. the code automatically runs on startup, and I cant stop it. I've tried to stop it in thonny and pressing CTRL+C. it keeps saying the pico is busy, and I have to wait till the program ends. I tried to open it in storage mode, but it continues to run the script. I also soldered a wire to the TP6 pad to make sure the bootsel button wasnt broken. still nothing. I think I have to flash RenameMainDotPy to the pico, but I'm not sure how to do that as the pico wont open in storage mode.
any help would be greatly appreciated.
I am a software engineer working on a microcontroller system for a side project. The microcontroller I am using is the SparkFun ProMicro (based on the RP2040 board). I am trying to flash the board so that I can write data to the onboard flash memory.
All of the tutorials I have found online suggest starting in boot mode, dragging and dropping the UF2 file, and done!
When I do this, the microcontroller ejects from my computer. Is that meant to happen? It just reboots then doesn't reboot in bootloader?
Once I got MicroPython installed I moved on to writing and flashing code to the board.
I am using the Thonny IDE which identified the correct board (albeit the PICO), then saved the following file as main.py (taken from RPI foundation). It prints toggle, and I believe the output shows that it is being printed from the board, but the light on the board isn't blinking. (code and output below)
I considered that the pinout could be different from this board and the PICO, but some research shows they both use Pin 25 for the LED control.
All this leads me to believe I am on the right path, but I think I am missing something that is taken for granted in the tutorials. My end goal is to write arbitrary text data to flash storage, but I understand it can only take about 8000-10,000 writes before it becomes unreliable, so I want to test that I can write working code before I use some of those.
Is there something I am missing, or am I not thinking about this in the right way?
When I do this, the microcontroller ejects from my computer. Is that meant to happen? It just reboots then doesn't reboot in bootloader?
Yep.
but the light on the board isn't blinking.
Maybe your LED is busted, cause your code is right.
My end goal is to write arbitrary text data to flash storage
That's a terrible idea, unless you just like burning up boards for no good reason. Get an SD Card reader or concoct one out of a solution like this one, and use this sdcard library that will even mount your card, and add it to the syspath. Then you can essentially write all the arbitrary text data you like without burning up your RP2040.
Blinking this LED was harder than I expected. I ended up finding this sample code from AdaFruit and using the commented out neopixel code. The... bright side was that there was way more control over this led that I had realized.
Dont forget you have to add the neopixel.mpy from the bundle to your board.
With the RPi Pico W, you can now identify the led pin with "LED" instead of pin 25 (or another pin). This change is due to pin 25 being used for the Wifi chip on the Pico W. This works on Pico W as below
from machine import Pin
import time
led = Pin("LED", Pin.OUT)
while True:
led.toggle()
time.sleep(0.5)
I have verified this working on a RPi Pico W with MicroPython - using the unstable python version - rp2-pico-w-20220719-unstable-v1.19.1-181-gc947c2529.uf2.
I believe this is intended to become the standard way to access an on board led, since the port can be changed for different boards without changing source code.
That's not a simple LED connected to pin 25 on the Pro Micro RP2040 - it's a WS2812 RGB LED, sometimes called a NeoPixel. There's a one-wire protocol to drive these devices.
MicroPython has support for NeoPixel's built-in:
from machine import Pin
from neopixel import NeoPixel
pin = Pin(25, Pin.OUT) # set Pin 25 to output to drive a NeoPixel
np = NeoPixel(pin, 1) # create NeoPixel driver on Pin 25 for a single pixel
np[0] = (255, 0, 0) # set the first pixel to red (R, G, B)
np.write()
See the rp2 Quickref for more details.
I have been doing development with Arduino for about a year. I recently got a NUCLEO - F429ZI board and have tried without success to get a very basic LED blink programming working. I am using the STM32cube IDE and have followed all of the online tutorials but nothing seems to work to my frustration.
I have checked that all jumpers are connected and that the GPIO pins are properly formatted. My led is connected via a resistor to PA3. No matter what code I use in the while loop the led does not blink. See below:
while (1)
{
HAL_GPIO_TogglePin(BLINKLED_GPIO_Port, BLINKLED_Pin);
HAL_Delay(1000);
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
Microcontroller GPIO Setup
If anyone could point out where I am going wrong here it would be brilliant because I'm all out of ideas!!
not strictly a programming question but found no other solutions on the web. Using the Pi i have followed the diagram below to control two motors in an old rc tank chassis.
diagram
Ive gotten all the hardware correct, i.e. H-Bridge etc but what happens is the motor connected to pins 7&11 (4 and 17 for BCM mode) just starts spinning.
My question is are any of these pins set to autimatically transmit a signal on power up or is this an OS issue. Any help would be much appreciated thx :).