Go Down

Topic: retrieve a data on csv file using sd card module and arduino uno (Read 109 times) previous topic - next topic

francisagrava

hello guys im working on my embedded thesis and my only problem is the retrieving data on csv file from sd card module. the scenario is like this when i insert a coin thermal printer will give you a unique username and password. the unique password is stored on sd card module please help me :D


Code: [Select]
#include <Wire.h>

LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address

volatile byte CoinPulseCount = 0;   // a counter to see how many times the pin has changed - which coin inserted
volatile byte hopperPulseCount = 0;  // a counter to she how many coins have been ejected
volatile unsigned long PulseTime;  //this stores the time of the last pulse.
byte NewCoinInserted;
byte Command = 0;

byte pulseThreshold = 200;  //EDIT THIS VALUE TO CHANGE DELAY BETWEEN DETECTING BANK OF PULSES

int hopperPin = 2;  // pin2 as optical count input
int coinSelectorPin = 3;  // pin3 as optical count input
int relayPin = 7;  // pin7 output relay
String OnePulse = "5 peso inserted";
String TwoPulses = "5 peso inserted";
String ThreePulses = "10 peso inserted";
SoftwareSerial mySerial(RX_PIN, TX_PIN); // Declare SoftwareSerial obj first
Adafruit_Thermal printer(&mySerial); 
void setup()
{
  mySerial.begin(19200);

  pinMode(hopperPin, INPUT_PULLUP);       
  pinMode(coinSelectorPin, INPUT_PULLUP);
  pinMode (relayPin, OUTPUT);     
  digitalWrite(relayPin, HIGH);   
  digitalWrite(hopperPin, HIGH);
  attachInterrupt(1, coinacceptor, FALLING);
  lcd.begin (16, 2); // for 16 x 2 LCD module
  lcd.print("Coinect Hotspot");
  printer.begin();
 
}

void loop()
{
   
  //CHECK NOW TO SEE WHICH COIN IS INSERTED
if(CoinPulseCount > 0 && millis() - PulseTime > 200){
                NewCoinInserted = CoinPulseCount;
                CoinPulseCount = 0;
        }

  //Proccess the coin inserted

  switch (NewCoinInserted)
  {
                           
           
                case 1:
                        lcd.setCursor(0,1);
                        lcd.print(OnePulse);
                        NewCoinInserted = 0;
                         break;
                case 2:
                        lcd.setCursor(0,1);
                        lcd.print(TwoPulses);
                        NewCoinInserted = 0;
                        break;
                case 3:
                        lcd.setCursor(0,1);
                        lcd.print(ThreePulses);
                        NewCoinInserted = 0;
                        break;
                       
 
  }
}
//*****INTERUPT detecting pulses from the coin acceptor
void coinacceptor()      //Function called when coin enters coin acceptor
{
  CoinPulseCount++;
  PulseTime = millis();   //store current time in pulseTime
}


PaulS

Quote
and my only problem is the retrieving data on csv file from sd card module
Under what circumstances do you want to read data from the file?

Which record do you want to read data from?

What do you want to do with that data?
The art of getting good answers lies in asking good questions.

francisagrava

Sorry for my late reply. my embedded thesis is a wifi vendo machine. i want to retrieve the unique username and password from sd card module save as csv file from MikroTik the username and password is auto generated by MikroTik router and i will only save it to sd card to print it when the coin acceptor detect the coin inserted and show on the lcd screen all the transaction happening

Go Up