Multiple independant FSR inputs contolling LED outputs

I'm working on a project where I have 3 FSR's(Force sensing resistors) as my inputs and I want each FSR to control 4 LED's. Basically the more force applied to the FSR, the more LED's turn on, i.e most force = 4/4 LED's on. However i want the First LED to always be on.

I've managed to code 1 FSR to work with 4 LED's and give the required result, but I'm not sure how to code in the other 2 to work with my Arduino UNO.

Here's the code for the 1 FSR that worked.

int fsr = A0;
int LED1 = 12;
int LED2 = 11;
int LED3 = 10;
int LED4 = 9;
int fsrread;

void setup(void){
  Serial.begin(9600);
  pinMode(LED1, OUTPUT);
  pinMode(LED2, OUTPUT);
  pinMode(LED3, OUTPUT);
  pinMode(LED4, OUTPUT);
}

void loop(void){
  fsrread = analogRead(fsr);
  Serial.println(fsrread);
  
if(fsrread > 200){
digitalWrite(LED2, HIGH);}
else digitalWrite(LED2, LOW);

if(fsrread > 400){
digitalWrite(LED3, HIGH);}
else digitalWrite(LED3, LOW);

if(fsrread > 800){
digitalWrite(LED4, HIGH);}
else digitalWrite(LED4, LOW);

if(fsrread =0){
digitalWrite(LED1, HIGH);}
else digitalWrite(LED1, HIGH);
}

I've looked into other forums and other sources and can't seem to find the solution. I was wondering whether this can only be done with an arduino MEGA, but wanted to be sure before I buy it.

Any help will be extremely appreciated.

P.S. I am extremely new to programming so may not be familiar with certain concepts, so elaboration would help a lot.

Thanks.

However i want the First LED to always be on.

Then you don't need an Arduino pin for it. Just wire it direct to 5V (with a series resistor of course).

Your code is already rather long and laborious. It's about to get 4 times worse because you now need to repeat it almost identically 3 more times.

You need to learn to use arrays and for() loops. You can keep your analog pin numbers in an array. You can keep your led pin numbers in another array, a 2-dimensional one. And you can keep your threshold values in yet another array.

Also I spotted an error in your code:

if(fsrread =0){

In C, "=" and "==" do different things. One assigns, one compares.

Thanks for the advice.

I'm disapointed in myself for not realising this.... :sweat_smile:

Then you don't need an Arduino pin for it. Just wire it direct to 5V (with a series resistor of course).

Also thanks for that note, i'll bear it in mind

In C, "=" and "==" do different things. One assigns, one compares.

I've looked up arrays and for ()loops as you suggested, but i'm still a little puzzled on how to use it correctly. Could you possibly help me out by giving an example?