One part tries to capture data from serial and try to write it on SD card. Other part simply transmits data over serial.
nimit393:
/*
*/
#include <SD.h>
#include <SPI.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3);
File myFile;
int pinCS = 4; // Pin 10 on Arduino Uno
uint16_t i = 0;
char a[512];
void setup() {
mySerial.begin(57600);
Serial.begin(57600);
pinMode(pinCS, OUTPUT);
// SD Card Initialization
if (SD.begin())
{
Serial.println("SD card is ready to use.");
} else
{
Serial.println("SD card initialization failed");
return;
}
// Reading the file
myFile = SD.open("123.txt");
if (myFile) {
Serial.println("Read:");
// Reading the whole file
while (myFile.available()) {
Serial.write(myFile.read());
//Serial.write(mySerial.read());
//myFile.write(mySerial.read());
}
myFile.close();
}
myFile = SD.open("456.txt", FILE_WRITE);
if (myFile) {
Serial.println("Read:");
// Reading the whole file
while (myFile.available()) {
// myFile.print(mySerial.read());
//if (mySerial.available() > 0)
{
//myFile.print(mySerial.read());
myFile.print("1234567");
Serial.write(myFile.read());
myFile.close(); // close the file
}
}}
else {
Serial.println("error opening 123.txt");
}
}
void loop() {
// empty
/* if (mySerial.available() > 0)
{
//Serial.println(mySerial.read(),HEX);
a[i] = mySerial.read();
//Serial.println(a,HEX);
i++;
}*/
//Serial.println(a[100],HEX);
//Serial.println(a);
delay(3000);
}
#include <Adafruit_Fingerprint.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(11, 12);
uint8_t P[] = {
0xEF,
0x01,
0xFF,
0xFF,
0xFF,
0xFF,
0x02,
0x00,
0x82,
0x03,
0x01,
0x52,
0x30,
0x6C,
0x00,
0xFF,
0xFE,
0xFF,
0xFE,
0x81,
0xFE,
0x00,
0x3E,
0x00,
0x1E,
0x00,
0x1E,
0x00,
0x0E,
0x00,
0x0E,
0x00,
0x0E,
0x00,
0x0E,
0x00,
0x06,
0x00,
0x06,
0x00,
0x06,
0x00,
0x06,
0x80,
0x06,
0x80,
0x06,
0x80,
0x0E,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
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F,
0xFF,
0xFF,
0x08,
0x00,
0x82,
0x26,
0x96,
0x8A,
0x9B,
0x36,
0xA5,
0xA1,
0xFB,
0x3D,
0xA9,
0xCA,
0xDB,
0x40,
0x2D,
0xA1,
0x7B,
0x3C,
0x35,
0x8B,
0x7B,
0x35,
0x40,
0x20,
0x1B,
0x3C,
0x15,
0xA1,
0x78,
0x53,
0x24,
0x0D,
0x98,
0x41,
0xB1,
0x63,
0x18,
0x5B,
0xBE,
0xC8,
0xD8,
0x47,
0x32,
0x64,
0xF9,
0x41,
0x39,
0xE2,
0x39,
0x57,
0x42,
0x48,
0x59,
0x4E,
0x24,
0x0D,
0xB6,
0x54,
0xBF,
0xC9,
0xD7,
0x51,
0xB2,
0x0B,
0xF4,
0x32,
0xB3,
0xDE,
0xB4,
0x47,
0x9B,
0x49,
0xEF,
0x4E,
0x31,
0x8C,
0x55,
0x59,
0xB1,
0xCC,
0x55,
0x61,
0xBB,
0xE0,
0xD5,
0x31,
0x3C,
0xC9,
0x95,
0x49,
0x3D,
0x4B,
0xB5,
0x4C,
0xAC,
0xE4,
0x90,
0x48,
0xAB,
0x23,
0x71,
0x30,
0x34,
0x8B,
0x51,
0x58,
0xBA,
0x61,
0xED,
0x1B,
0xB8,
0xE0,
0xCF,
0x2A,
0xB9,
0x4C,
0x2F,
0x50,
0xB6,
0xE2,
0x6C,
0x1E,
0xB8,
0x0B,
0x4C,
0x53,
0xB7,
0x0B,
0x6D,
0x3B,
0x0C};
uint8_t T[]={
0xEF,
0x01,
0xFF,
0xFF,
0xFF,
0xFF,
0x01,
0x00,
0x04,
0x09,
0x01,
0x00,
0x0F};
uint8_t U[]={
0xEF,
0x01,
0xFF,
0xFF,
0xFF,
0xFF,
0x01,
0x00,
0x06,
0x06,
0x01,
0x00,
0x10,
0x00,
0x1E};
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);
void setup()
{
Serial.begin(57600);
while (!Serial); // For Yun/Leo/Micro/Zero/...
finger.begin(57600);
for (uint8_t i = 0; i < 13; i++)
{
mySerial.write(T[i]);
}
delay(1000);
for (uint8_t i = 0; i < 139; i++)
{
mySerial.write(P[i]);
}
delay(1000);
for (uint8_t i = 0; i < 139; i++)
{
mySerial.write(Q[i]);
}
delay(1000);
for (uint8_t i = 0; i < 139; i++)
{
mySerial.write(R[i]);
}
delay(1000);
for (uint8_t i = 0; i < 139; i++)
{
mySerial.write(S[i]);
}
delay(1000);
for (uint8_t i = 0; i < 15; i++)
{
mySerial.write(U[i]);
}
delay(1000);
mySerial.end();
}
void loop() // run over and over again
{
//mySerial.write(B);
//delay(1000);
}