Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : [PicoMite] aliases
Author | Message | ||||
fmafma Newbie Joined: 30/06/2023 Location: FrancePosts: 31 |
Hi! I'm new to PicoMite, and I started to write a 1D pong game like this one. I implemented most of the game, simulating it on the console; next step will be to attach a WS2812. I have a question: is it possible to define aliases, to point to GPIOs? Like: DIM GAME_LED_PIN = GP2 which does not work... Thanks, Frédéric PS : I have to say that PicoMite is awesome! There is even more batteries included than in Micropython! The fact that I can connect to a board through minicom, and start coding without any external tool reminds me my Amstrad CPC I will surely propose to my students to use it for they projects, as they can't spend too much time in coding, and they often mess up C/C++ code... Frédéric |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9129 |
Welcome to the forum You can do it like this DIM GAME_LED_PIN = MM.INFO(PINNO GP2) |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6798 |
Welcome, fmffma :) You mention using a WS2812. If it's single one, fitted to a Pico clone board, then it will almost certainly be a type O and not the type B usually found in strips. These single ones can be used like this: BITBANG WS2812 O, <pin_number>, 1, RGB(<red_value>, <green_value>, <blue_value> I usually find them too bright if using, for example, RGB(red). RGB(60,0,0) is far more bearable. :) The manual shows how to use a string of them. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
fmafma Newbie Joined: 30/06/2023 Location: FrancePosts: 31 |
Ok, I see. Thank you! Frédéric |
||||
fmafma Newbie Joined: 30/06/2023 Location: FrancePosts: 31 |
I will use a strip, so I guess it is type B. But I note your comment for onboard RGB LEDs. Thanks! Frédéric |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6798 |
If using a strip just beware... They are actually 5V devices and are not guaranteed to work at 3V3. Also, the 3V3 supply from the PicoMite is from a switching power supply with a maximum output of about 300mA. That's only five LEDs at full brightness - and you may not manage that. Also, the logic level for the first LED is, according to spec, too high to work with a 3V3 input. A very neat way to get round this is to power the first LED from 5V via a silicon diode. That drops its supply voltage and, as the high logic level is a percentage of that, it brings it into range of a 3V3 input (a series resistor of 1k or so is recommended). The rest of the string should be powered from 5V as usual. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
fmafma Newbie Joined: 30/06/2023 Location: FrancePosts: 31 |
Yes, the strip has its own power supply. About the levels, I'm not sure to understand the issue with the first LED... We used this strip for the big sign at the entrance of our hackerspace , and I'm pretty sure it was driven with an ESP8266, which is also 3.3V rated. It was working fine. I'm about to test it, I'll let you know how it goes. Thanks, Frédéric |
||||
fmafma Newbie Joined: 30/06/2023 Location: FrancePosts: 31 |
The LEd strip works fine Frédéric |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6798 |
Good. :) They often do work, but according to the spec for the WS2812B they shouldn't. :) Input voltage high is a minimum of 0.7 x VDD. If VDD is 5v then Vhigh = 3.5V. In theory a 3V3 input won't switch them on. Powering the first LED at 5 - 0.6 = 4.4V makes Vhigh 3.08V which is just nice. If you can fit a diode in it's belt and braces - guaranteed to work. Data sheet Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
fmafma Newbie Joined: 30/06/2023 Location: FrancePosts: 31 |
Ok, I understand the first LED trick. Frédéric |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6798 |
Yep. Powering the first LED from 3V3 also works, but it's a bit less useful as the first one then has to be on the PCB with the 3V3 supply (or run an extra wire). With a bit of fiddling you can fit the diode on the strip, although you are now powering it at the second LED rather than the first. For shortish strips you can just power the lot via a diode to keep things easy. I like easy. :) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
Print this page |