Transmission sans fils

Cours

TSF_volet 1

TSF_volet 2

Generalité Exercices

TSF_LED IR

Exercice v2

TSF_NFC

Module Bluetooth / BLE

A venir prochainement

Module Wifi

Wifi

Guide de configuration et d’utilisation-WiFly Command Reference

RN171

RN171v2

commande wifi

Module RFID / NFC

NFC_part1

NFC Module for Arduino V1.0_SCH

pn532ds

pn532um

/**************************************************************************/
/*!
To enable debug message, define DEBUG in PN532/PN532_debug.h

*/
/**************************************************************************/

/* When the number after #if set as 1, it will be switch to SPI Mode*/
#if 0
#include <SPI.h>
#include <PN532_SPI.h>
#include « PN532.h »

PN532_SPI pn532spi(SPI, 10);
PN532 nfc(pn532spi);

/* When the number after #elif set as 1, it will be switch to HSU Mode*/
#elif 1
#include <PN532_HSU.h>
#include <PN532.h>

PN532_HSU pn532hsu(Serial);
PN532 nfc(pn532hsu);

/* When the number after #if & #elif set as 0, it will be switch to I2C Mode*/
#else
#include <Wire.h>
#include <PN532_I2C.h>
#include <PN532.h>
#include <NfcAdapter.h>

PN532_I2C pn532i2c(Wire);
PN532 nfc(pn532i2c);
#endif

char incomingByte; // for incoming serial data –> correction du Space Marine
String message; // Message de commande

void setup(void) {
int test=0; //Variable de test d’activation de la nfc
Serial.begin(115200);
//Serial.println(« Hello! »);
nfc.begin();
uint32_t versiondata = nfc.getFirmwareVersion();
if (! versiondata) {
Serial.print(« Didn’t find PN53x board »);
while(test==0)
{
//Serial.print(« test »);
if (Serial.available() > 0)
{
// Serial.print(« Old Message : « );
// Serial.println(message);
// read the incoming byte:
incomingByte = Serial.read();

// say what you got:
Serial.print(« I received: « );
Serial.println(incomingByte, DEC);

switch(incomingByte)
{
case’>’ :
//Serial.println(message);
break;
case ‘<‘ :
for(int i = 0 ; i < message.length() ; i++)
{
Serial.print(i);
//Serial.print(« -« );
//message.setCharAt(32, i);
message = String();
}
break;
default :
message += incomingByte;
}
// pas encore testé, mais ça devrait passer (EDIT : c’est bon, ça marche)
if(message.equals(« Avance »))
{
Serial.println(« En avant toute, cap’tain ! « );
test=1;
}
}
}
}

// Got ok data, print it out!
Serial.print(« Found chip PN5 »); Serial.println((versiondata>>24) & 0xFF, HEX);
Serial.print(« Firmware ver. « ); Serial.print((versiondata>>16) & 0xFF, DEC);
Serial.print(‘.’); Serial.println((versiondata>>8) & 0xFF, DEC);

// Set the max number of retry attempts to read from a card
// This prevents us from waiting forever for a card, which is
// the default behaviour of the PN532.
nfc.setPassiveActivationRetries(0xFF);

// configure board to read RFID tags
nfc.SAMConfig();

Serial.println(« Waiting for an ISO14443A card »);
}

void loop(void) {
boolean success;
uint8_t uid[] = { 0, 0, 0, 0, 0, 0, 0 }; // Buffer to store the returned UID
uint8_t uidLength; // Length of the UID (4 or 7 bytes depending on ISO14443A card type)

// Wait for an ISO14443A type cards (Mifare, etc.). When one is found
// ‘uid’ will be populated with the UID, and uidLength will indicate
// if the uid is 4 bytes (Mifare Classic) or 7 bytes (Mifare Ultralight)
success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, &uid[0], &uidLength);

if (success) {
Serial.println(« Found a card! »);
Serial.print(« UID Length: « );Serial.print(uidLength, DEC);Serial.println( » bytes »);
Serial.print(« UID Value: « );
for (uint8_t i=0; i < uidLength; i++)
{
Serial.print( » 0x »);Serial.print(uid[i], HEX);
}
Serial.println(«  »);
// Wait 1 second before continuing
delay(1000);
}
else
{
// PN532 probably timed out waiting for a card
Serial.println(« Timed out waiting for a card »);
}
}

Module Infrarouge

IR

Article Télécommande_IR_1

Article Télécommande_IR_2

Prog_telecommande

led020

433MHz

433MHz

Caractéristique de la telecommande

Notice d’utilisation de la telecommande