Jump to content
View in the app

A better way to browse. Learn more.

Tinkerunity

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Geschrieben

Liebes Forum,

 

ich bin blutiger Anfänger in Sachen Bricklets und stehe vor dem Problem, dass das Beschreiben von NFC Tags Typ 2 nicht zu funktionieren scheint. Ich kann Tags auslesen, an Einstellungen wie IP, Port und Device-ID sollte es also nicht liegen.

 

Nachfolgend mein Code-Schnipsel, mit dem ich aktuell versuche eine Nachricht - hier "HelloWorld" - auf den NFC Tag zu schreiben.

 

[pre]if($state == BrickletNFCRFID::STATE_REQUEST_TAG_ID_READY) {

        echo "Tag found\n";

 

        // Write 16 byte to pages 5-8

$byte_arr = unpack('C*', 'HelloWorld');

$count = count($byte_arr);

$data_write = array();

$i = 1; //byte_arr doesn't have index 0

while($i <= 16) {

if($i <= $count) {

array_push($data_write, $byte_arr[$i]);

echo($byte_arr[$i].", ");

} else {

array_push($data_write, 0);

}

$i = $i + 1;

}

        $nfc->writePage(5, $data_write);

        echo "Writing data...\n";

    }[/pre]

 

In meinem $data_write Array stehen folgende Einträge, die dann an die writepage Funktion übergeben werden: 72, 101, 108, 108, 111, 87, 111, 114, 108, 100

 

Über Hilfe und Anregungen wäre ich Euch sehr dankbar.

 

Viele Grüße

Martin

Geschrieben

Ich nehme an, dass du das "Write Read Type 2" Beispiel angewandelt hast?

 

Ich habe deine Änderungen getestet und es funktioniert.

 

Wie testet du denn ob es funktioniert hat, bzw. wie stellst du fest, dass es nicht funktioniert hat?

Geschrieben
  • Autor

Hallo Photron,

 

danke für Deine Antwort!

 

Ich lasse mir in zwei weiteren if-Blocks die Seite wieder ausgeben und erhalte da andere Werte..

 

[pre].. else if($state == BrickletNFCRFID::STATE_WRITE_PAGE_READY) {

        // Request pages 5-8

        $nfc->requestPage(5);

        echo "Requesting data...\n";

    } else if($state == BrickletNFCRFID::STATE_REQUEST_PAGE_READY) {

        // Get and print pages

        $data = $nfc->getPage();

        echo "Read data: [" . $data[0];

 

        for($i = 1; $i < count($data); $i++) {

            echo " " . $data[$i];

        }

 

        echo "]\n";

}[/pre]

 

Danke und viele Grüße

Martin

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Reply to this topic...

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.