Hello!
I am not sure if it's the right forum section to ask, but I don't know what causes the problem...
I have connected fsr sensors and digital led strip, which I have cut and soldered to create a kind of matrix, but with different amount of led's in each line.
What I need to do is to create different patterns - like emoji, I have numbered each in the scheme, the black ones, should light up (see the attachment).
I tried matrix code first, but the amount of led's varies, so I switched to pixel, and I use adafruit pixel libraries.
THE MAIN ISSUE - when I test same code with less led's working in the same time - everything seems fine (image in the attachment). But when I try one pattern from the attachment (more has to be working though) some LED's start blinking, while they shouldn't. And if I test it too long it just stays on, though when the value of force is below 30 it should turn off, after a while they fade out.
I assumed it's because of insufficient power. I test it while connected to my laptop. My teacher gave me an advice to connect the arduino to the socket, but it stayed same - blinking like crazy. I still think it has to do something with the power. But maybe it could be something else? The code seems to be working, soldering was triple checked not only by me.
Do you have any suggestions? How to power or change the code or anything?
P.S. Here is the sample of the code:
#include <Adafruit_NeoPixel.h>
#ifdef AVR
#include <avr/power.h>
#endif
#define PIN 6
int fsrPin1 = A0;
int fsrPin2 = A1;
Adafruit_NeoPixel strip = Adafruit_NeoPixel(168, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
pinMode(fsrPin1, INPUT);
pinMode(fsrPin2, INPUT);
strip.begin();
strip.show(); // Initialize all pixels to 'off'
}
void loop() {
int fsrVal = analogRead(fsrPin1);
int fsrVal2 = analogRead(fsrPin2);
if(fsrVal < 30) {
strip.setPixelColor(1, 0);
strip.setPixelColor(8, 0);
}
strip.show();
if(fsrVal > 30 && fsrVal < 100) {
strip.setPixelColor(1, strip.Color(0, 255, 255));
strip.setPixelColor(8, strip.Color(255, 255, 0));
}
strip.show();
}