Comments (9)
the hardware side should be less of a problem, 5v, gnd and one gpio. Single LED are now quite easy and cheap to get, I've tinkered with them a bit, but the system freezes when I try to control the led, but I'm a complete beginner when it comes to programming and not skilled enough to debug it
Great project
from usbvalve.
Hey, thanks for your input.
Your idea is for sure interesting, and not to difficult to implement from a SW point of view. May be for HW is a bit more difficult: adding a Neopixel is going to complicate the DIY build.
I'm wondering to keep your idea for the pre-built board.
Anyway, thanks again for the idea. I'll try to integrate this somehow.
from usbvalve.
I think I can add something by using the on-board LED of the standard Pico board:
SOLID GREEN = All OK (which is ON by default at starup)
OFF = a warning message has been displayed (something with [!]
or [!!]
)
from usbvalve.
I tinkered a bit and found a quick and dirty solution based on NeoPixelConnect.
https://github.com/MrYsLab/NeoPixelConnect
My code is totally experimental and not professional, I don't know if it affects other functions. according to my tests everything seems to work so far.
I would be pleased if you could check whether my code affects the function. Or you might even see a possibility to include an improved version of my code in your project. I would provide a modified PCB and a case design if my code does not affect the functions.
I have used a single WS2812B.
PIN36 (3V3) of Pi -> VCC
PIN38 (GND) of Pi -> GND
PIN14 of Pi -> Din
Yes I have only tapped the 3V3 instead of the 5V but it is enough to power the LED.
In order not to contaminate the whole code, I only modified the printout(), which is not so nice, but quick and dirty.
Initialization
//START TryBreakFixAgain TrafficLight initialization
#include <NeoPixelConnect.h>
#define PixelPin 10 // PixelData Pin
#define PixelNum 1 // Pixel count
NeoPixelConnect pixels(PixelPin, PixelNum, pio0, 1);
//END TryBreakFixAgain TrafficLight initialization
modified printout()
void printout(const char *str)
{
display.print(str);
// START TryBreakFixAgain TrafficLight
String tlString = String(str);
tlString.replace(String(char(10)), "");
tlString.trim();
if (tlString.substring(0,3) == "[+] ") {
pixels.neoPixelFill(255, 255, 0, true);
}
else if (tlString.substring(0,3) == "[++") {
pixels.neoPixelFill(0, 255, 0, true);
}
else if (tlString.substring(0,3) == "[!]") {
pixels.neoPixelFill(255, 153, 51, true);
}
else if (tlString.substring(0,3) == "[!!") {
pixels.neoPixelFill(255, 0, 0, true);
}
else {
pixels.neoPixelFill(0, 0, 0, true);
pixels.neoPixelClear(true);
}
// END TryBreakFixAgain TrafficLight
}
from usbvalve.
Thanks for your proposal.
I think your code is good, but it can be simpler in our case. It should work fine (I didn't tried it), but instead of using strings function to check the printout buffer it should be enough to check the booleans used to report anomalies:
boolean readme = false;
boolean autorun = false;
boolean written = false;
boolean deleted = false;
boolean written_reported = false;
boolean deleted_reported = false;
boolean hid_sent = false;
boolean hid_reported = false;
Also, the logic you are using is a bit strange: you are setting yellow for [+]
messages, but that mean that yellow will be always set, since the selftest
is printed with [+]
. I would review it a bit.
I'm not sure I'm going to add this to the main branch, since I'd like to keep the HW build as simple as possible (and as I said I'll add something with the on-board led), but if you are going to work on it and create PCB and other things, I can create a dedicated branch for it, if you wish.
from usbvalve.
thank you very much, i am new to coding, i belong more to the 3d printing and soldering section.
i think it's very cool that you want to keep everything as simple as possible.
i'll keep tinkering with the idea for myself, it's a good opportunity to learn.
if it ever works exactly the way i want it to, i will let you know and of course make it available to everyone.
Thank you very much for your help and suggestions.
from usbvalve.
Thanks to you!!
And if you have any question, just get in touch.
from usbvalve.
I have taken the liberty to customize the code a bit to suit my needs,
I made all display output quickly configurable with json as I see the use of other languages in my environment.
On top of that I have built a traffic light system.
I am using a Ws2812b DOT (https://www.amazon.com/dp/B088K8DVMQ) on pin 10 (GPIO7).
Blue=something is plugged in , Green= all fine , Orange=caution, Red=bad things happen
All changes are documented in the code and can be found via TryBreakFixAgain and tbfa_.
I use ArduinoJson 7.0.4 from Benoit Blanchon
I decided to use the lib and json because I have future changes in mind that I want to make.
Since I am not a programmer, I declare the code as experimental.
Of course I make the idea and my changes available for adoption into the main code and for general use.
from usbvalve.
Thanks a lot for sharing your work!
As I anticipated, I'd like to keep the build as simple as possible, so I'm happy to keep your mods here if someone wants to use them, but I'd like just to make a super simple mods on the main code to use the on-board led.
Thanks again for sharing this!
from usbvalve.
Related Issues (20)
- Multiple USB Host ports HOT 1
- Buzzer Support? HOT 2
- Pi Pico Watch Supported Features HOT 1
- need some pointers please HOT 11
- writing text files not detected HOT 1
- uf2 file not flashing HOT 16
- Would Love PreBuilt One HOT 5
- Pico with built in display and usb-c HOT 3
- [Enhancement] Write dump HOT 14
- 3D Printable enclosure for 128x64 screen version HOT 15
- Debugger on the pcb version HOT 1
- Video Tutorial on how to build a USBValve HOT 6
- Is there a test scenario? HOT 3
- display not showing proper info HOT 33
- [Question] File read attempt filename HOT 4
- fast charge detection HOT 2
- pimoroni pico lipo / trafficlight and small things HOT 1
- Button Press Required on Boot? HOT 19
- ESP32 HOT 1
- Is it possible without the display? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from usbvalve.