-1

I've got a Dotstar strip, a piano, and an UNO(w a usb host shield). I can get and properly translate data from the piano to the UNO, so I'm definitely getting the right information to the board. When i hardcode input values into my code it reacts appropriately, so I know my code works. However, when I attempt to take data from the USB piano keyboard and light a corresponding LED, the whole strip lights up blue and green and flashes brightly between them. This happens before I even hit a key on the keyboard. When I hit a key, the correct light lights up for roughly a milisecond before returning to flashing green or blue.

I feel like there's some electrical concept that I'm not getting- I've got the MIDI information correctly making it to the board, and it can correctly control the LEDs. I don't know where it could be getting the data that's causing it to do this.

I think I might need a resistor- I tried to set an AND gate from the SS pin and the data pin, but that didn't do anything. The best image of my wiring that I could make in Paint

Here's the AND gate setup I attempted. enter image description here

  • 3
    Please include your code and wiring into the question by editing it – chrisl Dec 3 '19 at 20:44
1

The USB host shield and the LED strip use the same SPI bus. The USB host shield has a cable select line, but the LEDs don't, so they're always listening to the bus, even when the USB shield is using it.
You'll have to add some logic gates on the data and clock lines to the LED strip to turn them on or off, depending on another cable select line for the LEDs.

LED Clock = NOT LED CS AND SPI CLK
LED Data = NOT LED CS AND SPI MOSI

If you're only using two SPI devices, you could do:

LED Clock = USB CS AND SPI CLK
LED Data = USB CS AND SPI MOSI

https://forum.arduino.cc/index.php?topic=644679.msg4363133

Edit: Judging from the image, you're asking the exact same question as the one I already replied to on the Arduino forum a month ago. Why do you ask the same question twice if you're not even going to reply?

|improve this answer|||||
  • Took me a month to get a chance to try it-thought you'd have long forgotten about it. – skapunk1806 Dec 5 '19 at 21:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.