Coder Social home page Coder Social logo

Comments (9)

TryBreakFixAgain avatar TryBreakFixAgain commented on June 20, 2024 1

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.

cecio avatar cecio commented on June 20, 2024

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.

cecio avatar cecio commented on June 20, 2024

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.

TryBreakFixAgain avatar TryBreakFixAgain commented on June 20, 2024

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.

cecio avatar cecio commented on June 20, 2024

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.

TryBreakFixAgain avatar TryBreakFixAgain commented on June 20, 2024

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.

cecio avatar cecio commented on June 20, 2024

Thanks to you!!
And if you have any question, just get in touch.

from usbvalve.

TryBreakFixAgain avatar TryBreakFixAgain commented on June 20, 2024

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.

USBvalveLanguageLightMod.txt

from usbvalve.

cecio avatar cecio commented on June 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.