Skip to content

Instantly share code, notes, and snippets.

@gustavolaureano
gustavolaureano / main.py
Created August 4, 2023 20:15
MicroPython code for the raspberry pico to count how many WS2812 are connected, the data signal of the LEDs must be connected to GP2 and the ADC (GP26) must be connected to the strip ground after a jump wire (I used a cheap 20cm jumper cable), using the jumper as a shunt
import machine, neopixel, time
from machine import Pin, ADC
np = neopixel.NeoPixel(Pin(2), 200)
adcpin = machine.ADC(26)
while True:
num_of_leds = None
for i in range(len(np)):
onvalue = 0
#include <MQTTZephyr.h>
void TimerCountdownMS(Timer* timer, unsigned int timeout_ms)
{
timer->end_time = k_uptime_get() + timeout_ms;
}
void TimerCountdown(Timer* timer, unsigned int timeout)
#pragma once
#include <zephyr/types.h>
#include <stddef.h>
#include <string.h>
#include <errno.h>
#include <misc/printk.h>
#include <misc/byteorder.h>
#include <zephyr.h>