Giter VIP home page Giter VIP logo

magstripelib's People

Contributors

carlosefr avatar monsieurv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

magstripelib's Issues

Support for Simultaneous Reading of All 3 Tracks

Hello,

I am interested in getting this to work. What technical limitations exist that stop the library from being able to read all 3 tracks at once? Can only specific pins be used?

If we cannot get simultaneous reading to work, can we change the pins used in our program on the fly? So if 3 tracks are needed, the program can swap the pins to the 2nd and then 3rd track. It would require 3 swipes, but would still make reading all 3 tracks possible without changing any wiring.

Where is the out put displayed?

like the leds are changing with the insertion of a card and stuff but im getting 0 output in the serial monitor .. im using an osepp nano

ISR not in IRAM! User exception (panic/abort/assert)

Am using NodeMCU 1.0 ESP8266

At startup it bring this error.

ctx: cont
sp: 3ffffee0 end: 3fffffc0 offset: 0000
3ffffee0: 00000688 feefeffe feefeffe feefeffe
3ffffef0: 000000fe 00000000 00000000 00000000
3fffff00: 00000000 00000000 00000000 00ff0000
3fffff10: 5ffffe00 5ffffe00 feefeffe 00000000
3fffff20: 00000003 00000000 3ffee354 402021ba
3fffff30: 40100462 00002580 00000000 402021d0
3fffff40: 00000003 40203199 3ffee354 402026e1
3fffff50: 00000000 00000001 3ffee3e0 3ffee448
3fffff60: 00000000 00000001 3ffee3e0 3ffee448
3fffff70: 3fffdad0 00000000 3ffee354 40202790
3fffff80: 00002580 0000001c 00000000 40201228
3fffff90: 3fffdad0 00000000 3ffee408 40201050
3fffffa0: feefeffe feefeffe feefeffe 40201e10
3fffffb0: feefeffe feefeffe 3ffe84e4 40100d6d
<<<stack<<<
H!⸮ԅ⸮⸮⸮⸮⸮ISR not in IRAM!

User exception (panic/abort/assert)
Abort called

Magstripe causes program to hang/pause

I am using the MagStrip library (https://github.com/carlosefr/magstripelib 1). In my main loop I call the function which runs the code:

void magcardFunc()
{
static const byte DATA_BUFFER_LEN = 108;
static char magcard[DATA_BUFFER_LEN];
  
// Don't do anything if there isn't a card present

  if (!card.available()) {
    return;
  }

    // Read the card into the buffer "magcard" (as a null-terminated string)
  short chars = card.read(magcard, DATA_BUFFER_LEN);

  if (chars < 0) {
    Serial.print("bad read");
    return;
  }
  
  // Send the data to the computer if data was read
  if (chars != 0) {
    Serial.print(magcardstr);
  }
}

The code successfully reads a magnetic card when inserted.

The problem is, I have other functions which are called from the main loop but they do not get called as the code pauses at:

if (!card.available()) {
    return;
  }

    // Read the card into the buffer "magcard" (as a null-terminated string)
  short chars = card.read(magcard, DATA_BUFFER_LEN);

If I insert a card into my mag reader (and leave it there), the program continues and the other functions are called. I want the main loop to continue and the other functions be called without having to leave a card inserted.

I have tried removing the IF statement:

if (!card.available()) {
    return;
  }

and I have tried reversing it

if (card.available()) {
    return;
  }

If I reverse it as above, the other functions run but when I do swipe a card, it is not read.
I get no compiler errors.

An example sketch:

#include <MagStripe.h>

void magcardFunc();
void otherFunc();

MagStripe card;

static const byte DATA_BUFFER_LEN = 108;
static char data[DATA_BUFFER_LEN];


void setup()
{
  // The card data will be sent over serial...
  Serial.begin(9600);
  
  // Initialize the library for reading track 2...
  card.begin(2);
}


void loop()
{
  magcardFunc();
  otherFunc();
}
 
void magcardFunc()
{
  // Don't do anything if there isn't a card present...
  if (!card.available()) {
    return;
  }
  
  
  // Read the card into the buffer "data" (as a null-terminated string)...
  short chars = card.read(data, DATA_BUFFER_LEN);
  

  if (chars < 0) {
  Serial.println("no chars");

    return;
  }

  // Send the data to the computer...
  Serial.println(data);
}

void otherFunc()
{
  Serial.println("I am another function");
  delay(500); //feel free to remove me
}

Any help is appreciated.

Great Library

@carlosefr, thanks for this library. I did run into an issue with the card readers that I have but was able to fix it using a capacitor to filter the data line. I wrote up a blog post about it. I plan to make some changes to the library as I have an idea to make it more reliable for this type of issue.

The blog post is at https://teelsys.com/?p=708.

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.