Skip to content

Instantly share code, notes, and snippets.

#if 0 // 1 คือใช้งานแบบ SPI
#include <SPI.h>
#include <PN532_SPI.h>
#include <PN532.h>
#include <NfcAdapter.h>
PN532_SPI pn532spi(SPI, 10);
NfcAdapter nfc = NfcAdapter(pn532spi);
#else
#include <SoftwareSerial.h>
SoftwareSerial RDM(2,3); // RX and TX
int data1 = 0;
int ok = -1;
int yes = 13;
int no = 12;
int tag1[14] = {2,48,48,48,48,48,57,57,53,68,68,52,49,3}; // การ์ดที่เราอ่านได้จากโค้ดตัวอย่าง RDM6300_READ https://gist.github.com/arduinothai/f589c20d79ce28153b639bc2c46c6fe4
int newtag[14]= {0,0,0,0,0,0,0,0,0,0,0,0,0,0};
#include <SoftwareSerial.h>
SoftwareSerial RFID(2, 3); // RX and TX
int i;
void setup()
{
RFID.begin(9600); // start serial to RFID reader
Serial.begin(9600); // start serial to PC
}
void loop()
{
/* FSR simple testing sketch.
Connect one end of FSR to power, the other end to Analog 0.
Then connect one end of a 10K resistor from Analog 0 to ground
For more information see www.ladyada.net/learn/sensors/fsr.html */
int fsrPin = 0; // the FSR and 10K pulldown are connected to a0
int fsrReading; // the analog reading from the FSR resistor divider
int flexSensorPin = A0; //analog pin 0
void setup()
{
Serial.begin(9600);
}
void loop()
{
int flexSensorReading = analogRead(flexSensorPin);
Serial.println(flexSensorReading);
//In my tests I was getting a reading on the arduino between 512, and 614.
/***************************************************
DFRobot Gravity: Analog Spear Tip pH Sensor / Meter Kit (For Soil And Food Applications)
<https://www.dfrobot.com/wiki/index.php/Gravity:_Analog_Spear_Tip_pH_Sensor_/_Meter_Kit_(For_Soil_And_Food_Applications)_SKU:_SEN0249>
***************************************************
This product is used to measure the pH value of the semisolid,such as meat,fruit,moist soil and so on.
This sample code reads the pH value.
Created 2017-9-10
By Jason <jason.ling@dfrobot.com@dfrobot.com>
/************************************************************
Water pressure sensor demo(Computer serial port)
- Obtain the water pressure through the output voltage
of the sensor.
**************************************************************/
/************************************************************
Water Sensor Key Parameter
- Parts No.:KY-3-5
- Sensing range: 0 - 1.6 MPa
#define VERSION "\n\nAndroTest V2.0 - @kas2014\ndemo for V5.x App"
// V2.0 changed to pure ASCII Communication Protocol ** not backward compatible **
// V1.4 improved communication errors handling
// V1.3 renamed for publishing, posted on 09/05/2014
// V1.2 Text display ** not backward compatible **
// V1.1 Integer display
// V1.0 6 buttons + 4 data char implemented
// Demo setup:
// Button #1 controls pin #13 LED
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
the correct LED pin independent of which board is used.
If you want to know what pin the on-board LED is connected to on your Arduino model, check
the Technical Specs of your board at https://www.arduino.cc/en/Main/Products