Go Down

Topic: Controlling combinations of LEDS on a neopixel strip using RFID (Read 517 times) previous topic - next topic


I am working on a project and i am struggling with one error in my code. Basically what i want to do is light up different combinations of leds on a neopixel strip depending on the NFC card detected. I am doing this for a project related to coming up with different routes for indoor climbing and my idea is to set the lights depending on a level of difficulty which is determined for now on the distance between two holds on the wall. The way it should work is when the climber taps let's say Level1NFC card one LED lights up. The climber will have a bracelet which will basically have a distance sensor so when they reach to put the hold and get to less than 30cm to the wall the second LED will light up. and so on. For now i am exploring how to activate different combinations of LEDS with an NFC card. I will be very grateful if you can help me with the code and maybe give me feedback on my whole idea. Thank you very much!!!
P.S i am not very advanced in coding

This is my code (I have used several codes as examples to make this one):

#include <SPI.h>
#include <MFRC522.h>
#include <Adafruit_NeoPixel.h>
#include <Process.h>

#define RST_PIN   9   
#define SS_PIN    10
#define NEO_PIN 6
#define NEO_NUM 10
#define NEO_NUM Combinations

<p>//NEO_LED Combinations<br>  int easy[] = {0, 1, 2, 3, 7, 5, 6, 9, 10};
    int easyLength = 9;
    int med[] = {0, 1, 2, 3, 4,  9, 10, 8};
    int medLength = 8;
    int hard[] = {0, 1, 2, 3, 4, 7};
    int hardLength = 6;

Adafruit_NeoPixel strip = Adafruit_NeoPixel(NEO_LED Combinations, NEO_NUM, NEO_PIN, NEO_GRB + NEO_KHZ800);

MFRC522 mfrc522(SS_PIN, RST_PIN);   // Create MFRC522 instance

MFRC522::MIFARE_Key key;

void setup() {
  Serial.begin(9600);  // Initialize serial communications with the PC
  SPI.begin();         // Init SPI bus
  mfrc522.PCD_Init();  // Init MFRC522 card
  // Prepare key - all keys are set to FFFFFFFFFFFFh at chip delivery from the factory.
  for (byte i = 0; i < 6; i++) {
    key.keyByte = 0xFF;

  strip.show(); // Initialize all pixels to 'off'
  Serial.println("Ready to read a card");
  void loop() {
    uint32_t c;
    if(str[0] == 136) 
    c = easyLength.Color(255, 0, 255);
      c = easyLength.Color(0, 255, 0);

ERROR: expected unqualified-id before '<' token

Go Up