<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic ATtiny85 in Other NXP Products</title>
    <link>https://community.nxp.com/t5/Other-NXP-Products/ATtiny85/m-p/1853345#M22347</link>
    <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;hi , I have writing code on arduino ide platform for a scenario.&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;STRONG&gt;scenario:&lt;/STRONG&gt; attiny85 should measure the frequency from the astable multivibrator circuit using 555 timer where the one of resistance is replaced by the force sensing resistor (Force-sensing resistors (FSR) are devices whose resistance changes when a force is applied to them) , astable multivibrator circuit using 555 timer output is given to the pb4 of attiny85 and then attiny85(master) should send the measured frequency value to arduino uno(slave) using i2c communication and arduino uno should receive the frequency value and print in the serial monitor. i have pasted the below attiny85 master code and arduino uno slave code.&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;STRONG&gt;&lt;U&gt;master code ( ATtiny85)&lt;/U&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;P&gt;const int inputPin = 4; // Input pin PB4&lt;BR /&gt;unsigned long pulseStartTime = 0;&lt;BR /&gt;unsigned long pulseEndTime = 0;&lt;BR /&gt;#define I2C_SLAVE_ADDRESS 0x48 // Address of the slave&lt;BR /&gt;&lt;BR /&gt;#include &amp;lt;TinyWireM.h&amp;gt;&lt;/P&gt;&lt;P&gt;void setup() {&lt;BR /&gt;pinMode(inputPin, INPUT);&lt;BR /&gt;TinyWireM.begin();&lt;BR /&gt;TinyWireM.beginTransmission(I2C_SLAVE_ADDRESS); // Initialize I2C communication&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;void loop() {&lt;BR /&gt;// Wait for the rising edge&lt;BR /&gt;while (digitalRead(inputPin) == LOW) {&lt;BR /&gt;// Do nothing&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// Record the start time of the pulse&lt;BR /&gt;pulseStartTime = micros();&lt;/P&gt;&lt;P&gt;// Wait for the falling edge&lt;BR /&gt;while (digitalRead(inputPin) == HIGH) {&lt;BR /&gt;// Do nothing&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;// Record the end time of the pulse&lt;BR /&gt;pulseEndTime = micros();&lt;/P&gt;&lt;P&gt;// Calculate pulse width&lt;BR /&gt;unsigned long pulseWidth = pulseEndTime - pulseStartTime;&lt;BR /&gt;float frequency = 1000000.0 / pulseWidth; // Calculate frequency in Hz&lt;BR /&gt;&lt;BR /&gt;// Convert frequency to bytes for I2C transmission&lt;BR /&gt;uint8_t frequencyBytes[4]; // Assuming frequency will fit within 4 bytes&lt;BR /&gt;memcpy(frequencyBytes, &amp;amp;frequency, sizeof(frequency));&lt;/P&gt;&lt;P&gt;// Send frequency bytes over I2C&lt;BR /&gt;TinyWireM.write(frequencyBytes, sizeof(frequencyBytes));&lt;BR /&gt;&lt;BR /&gt;// End transmission&lt;BR /&gt;TinyWireM.endTransmission();&lt;/P&gt;&lt;P&gt;// Delay before next measurement&lt;BR /&gt;delay(100);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;slave code ( arduino uno )&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;#include &amp;lt;Wire.h&amp;gt;&lt;/P&gt;&lt;P&gt;const int slaveAddress = 0x48;&lt;/P&gt;&lt;P&gt;void setup() {&lt;BR /&gt;Serial.begin(9600); // Initialize serial communication at 9600 bps.&lt;BR /&gt;Wire.begin(slaveAddress); // Join i2c bus with the address specified as slaveAddress&lt;BR /&gt;Wire.onReceive(receiveEvent); // Register the receive event function&lt;BR /&gt;Serial.println("Ready to receive frequency data...");&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;void loop() {&lt;BR /&gt;// Nothing to do here, all processing occurs in the receiveEvent function.&lt;BR /&gt;delay(100); // Optional: slight delay to ease the CPU workload if needed.&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// Function called by the Wire library when data is received.&lt;BR /&gt;void receiveEvent(int howMany) {&lt;BR /&gt;if (howMany &amp;gt;= 4) { // Ensure we have at least 4 bytes for a float value&lt;BR /&gt;byte frequencyBytes[4];&lt;BR /&gt;for (int i = 0; i &amp;lt; 4; ++i) {&lt;BR /&gt;if (Wire.available()) {&lt;BR /&gt;frequencyBytes[i] = Wire.read(); // Read a byte from the I2C buffer&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;float frequency;&lt;BR /&gt;memcpy(&amp;amp;frequency, frequencyBytes, sizeof(frequency)); // Recompile the bytes back into the single float&lt;/P&gt;&lt;P&gt;// Print the frequency to Serial Monitor&lt;BR /&gt;Serial.print("Received Frequency: ");&lt;BR /&gt;Serial.print(frequency);&lt;BR /&gt;Serial.println(" Hz");&lt;BR /&gt;}&lt;BR /&gt;else {&lt;BR /&gt;Serial.println("Error: Not enough bytes received");&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;when i implement this code in hardware&amp;nbsp; , the code is working but its output value printing in arduino ide is&amp;nbsp; largely fluctuating and showing wrong values. I dont know how to rectify it.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Wed, 24 Apr 2024 09:52:13 GMT</pubDate>
    <dc:creator>Robert11</dc:creator>
    <dc:date>2024-04-24T09:52:13Z</dc:date>
    <item>
      <title>ATtiny85</title>
      <link>https://community.nxp.com/t5/Other-NXP-Products/ATtiny85/m-p/1853345#M22347</link>
      <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;hi , I have writing code on arduino ide platform for a scenario.&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;STRONG&gt;scenario:&lt;/STRONG&gt; attiny85 should measure the frequency from the astable multivibrator circuit using 555 timer where the one of resistance is replaced by the force sensing resistor (Force-sensing resistors (FSR) are devices whose resistance changes when a force is applied to them) , astable multivibrator circuit using 555 timer output is given to the pb4 of attiny85 and then attiny85(master) should send the measured frequency value to arduino uno(slave) using i2c communication and arduino uno should receive the frequency value and print in the serial monitor. i have pasted the below attiny85 master code and arduino uno slave code.&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;STRONG&gt;&lt;U&gt;master code ( ATtiny85)&lt;/U&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;P&gt;const int inputPin = 4; // Input pin PB4&lt;BR /&gt;unsigned long pulseStartTime = 0;&lt;BR /&gt;unsigned long pulseEndTime = 0;&lt;BR /&gt;#define I2C_SLAVE_ADDRESS 0x48 // Address of the slave&lt;BR /&gt;&lt;BR /&gt;#include &amp;lt;TinyWireM.h&amp;gt;&lt;/P&gt;&lt;P&gt;void setup() {&lt;BR /&gt;pinMode(inputPin, INPUT);&lt;BR /&gt;TinyWireM.begin();&lt;BR /&gt;TinyWireM.beginTransmission(I2C_SLAVE_ADDRESS); // Initialize I2C communication&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;void loop() {&lt;BR /&gt;// Wait for the rising edge&lt;BR /&gt;while (digitalRead(inputPin) == LOW) {&lt;BR /&gt;// Do nothing&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// Record the start time of the pulse&lt;BR /&gt;pulseStartTime = micros();&lt;/P&gt;&lt;P&gt;// Wait for the falling edge&lt;BR /&gt;while (digitalRead(inputPin) == HIGH) {&lt;BR /&gt;// Do nothing&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;// Record the end time of the pulse&lt;BR /&gt;pulseEndTime = micros();&lt;/P&gt;&lt;P&gt;// Calculate pulse width&lt;BR /&gt;unsigned long pulseWidth = pulseEndTime - pulseStartTime;&lt;BR /&gt;float frequency = 1000000.0 / pulseWidth; // Calculate frequency in Hz&lt;BR /&gt;&lt;BR /&gt;// Convert frequency to bytes for I2C transmission&lt;BR /&gt;uint8_t frequencyBytes[4]; // Assuming frequency will fit within 4 bytes&lt;BR /&gt;memcpy(frequencyBytes, &amp;amp;frequency, sizeof(frequency));&lt;/P&gt;&lt;P&gt;// Send frequency bytes over I2C&lt;BR /&gt;TinyWireM.write(frequencyBytes, sizeof(frequencyBytes));&lt;BR /&gt;&lt;BR /&gt;// End transmission&lt;BR /&gt;TinyWireM.endTransmission();&lt;/P&gt;&lt;P&gt;// Delay before next measurement&lt;BR /&gt;delay(100);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;slave code ( arduino uno )&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;#include &amp;lt;Wire.h&amp;gt;&lt;/P&gt;&lt;P&gt;const int slaveAddress = 0x48;&lt;/P&gt;&lt;P&gt;void setup() {&lt;BR /&gt;Serial.begin(9600); // Initialize serial communication at 9600 bps.&lt;BR /&gt;Wire.begin(slaveAddress); // Join i2c bus with the address specified as slaveAddress&lt;BR /&gt;Wire.onReceive(receiveEvent); // Register the receive event function&lt;BR /&gt;Serial.println("Ready to receive frequency data...");&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;void loop() {&lt;BR /&gt;// Nothing to do here, all processing occurs in the receiveEvent function.&lt;BR /&gt;delay(100); // Optional: slight delay to ease the CPU workload if needed.&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// Function called by the Wire library when data is received.&lt;BR /&gt;void receiveEvent(int howMany) {&lt;BR /&gt;if (howMany &amp;gt;= 4) { // Ensure we have at least 4 bytes for a float value&lt;BR /&gt;byte frequencyBytes[4];&lt;BR /&gt;for (int i = 0; i &amp;lt; 4; ++i) {&lt;BR /&gt;if (Wire.available()) {&lt;BR /&gt;frequencyBytes[i] = Wire.read(); // Read a byte from the I2C buffer&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;float frequency;&lt;BR /&gt;memcpy(&amp;amp;frequency, frequencyBytes, sizeof(frequency)); // Recompile the bytes back into the single float&lt;/P&gt;&lt;P&gt;// Print the frequency to Serial Monitor&lt;BR /&gt;Serial.print("Received Frequency: ");&lt;BR /&gt;Serial.print(frequency);&lt;BR /&gt;Serial.println(" Hz");&lt;BR /&gt;}&lt;BR /&gt;else {&lt;BR /&gt;Serial.println("Error: Not enough bytes received");&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;when i implement this code in hardware&amp;nbsp; , the code is working but its output value printing in arduino ide is&amp;nbsp; largely fluctuating and showing wrong values. I dont know how to rectify it.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 24 Apr 2024 09:52:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Other-NXP-Products/ATtiny85/m-p/1853345#M22347</guid>
      <dc:creator>Robert11</dc:creator>
      <dc:date>2024-04-24T09:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: ATtiny85</title>
      <link>https://community.nxp.com/t5/Other-NXP-Products/ATtiny85/m-p/1855945#M22416</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope you are doing well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are using &lt;A href="https://www.nxp.com/products/rfid-nfc/nfc-hf/connected-nfc-tags/ntag-ic-plus-2k-nfc-forum-type-2-tag-with-ic-interface:NTAG_I2C" target="_blank"&gt;NTAG I2C Plus&lt;/A&gt;, right?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If my understanding is correct, the current issue you are having is related to getting the frequency from your sensor, right?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or are you presenting an issue with NTAG I2C Plus?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Ricardo&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2024 20:36:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Other-NXP-Products/ATtiny85/m-p/1855945#M22416</guid>
      <dc:creator>Ricardo_Zamora</dc:creator>
      <dc:date>2024-04-26T20:36:34Z</dc:date>
    </item>
    <item>
      <title>Re: ATtiny85</title>
      <link>https://community.nxp.com/t5/Other-NXP-Products/ATtiny85/m-p/1856046#M22417</link>
      <description>First of all thanks for the response from your side.&lt;BR /&gt;&lt;BR /&gt;Yes, I am using NTAG I2C PLUS (NT3H2111)&lt;BR /&gt;&lt;BR /&gt;At present ,I have problem in capturing and measuring he frequency from the 555 timer using AVR 8 bit microcontroller ATtiny85.&lt;BR /&gt;&lt;BR /&gt;At the moment , the main query is "I want do ndef format the measured frequency data and store it in the EEPROM of NT3H2111 where the data should be available for NFC communication. NT3H2111 is powered by external power supply not by energy harvesting and fd pin kept open. Is there any library or resource that helpfull in doing the above specified work"</description>
      <pubDate>Sat, 27 Apr 2024 06:08:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Other-NXP-Products/ATtiny85/m-p/1856046#M22417</guid>
      <dc:creator>Robert11</dc:creator>
      <dc:date>2024-04-27T06:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: ATtiny85</title>
      <link>https://community.nxp.com/t5/Other-NXP-Products/ATtiny85/m-p/1856047#M22418</link>
      <description>&lt;P&gt;First of all thanks for the response from your side.&lt;BR /&gt;&lt;BR /&gt;Yes, I am using NTAG I2C PLUS (NT3H2111)&lt;/P&gt;&lt;P&gt;At present ,I have problem in capturing and measuring he frequency from the 555 timer using AVR 8 bit microcontroller ATtiny85.&lt;/P&gt;&lt;P&gt;At the moment , the main query is "I want do ndef format the measured frequency data and store it in the EEPROM of NT3H2111 where the data should be available for NFC communication. NT3H2111 is powered by external power supply not by energy harvesting and fd pin kept open. Is there any library or resource that helpfull in doing the above specified work"&lt;/P&gt;</description>
      <pubDate>Sat, 27 Apr 2024 06:09:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Other-NXP-Products/ATtiny85/m-p/1856047#M22418</guid>
      <dc:creator>Robert11</dc:creator>
      <dc:date>2024-04-27T06:09:29Z</dc:date>
    </item>
    <item>
      <title>Re: ATtiny85</title>
      <link>https://community.nxp.com/t5/Other-NXP-Products/ATtiny85/m-p/1856903#M22436</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some of our MCU's have support for NTAG I2C Plus. You can check the &lt;A href="https://mcuxpresso.nxp.com/en/select/middleware" target="_blank"&gt;Select Middleware | MCUXpresso SDK Builder&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And also, you could check this &lt;A href="https://www.nxp.com/docs/en/user-guide/UM10950.pdf" target="_blank"&gt;UM10950&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Ricardo&lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2024 17:11:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Other-NXP-Products/ATtiny85/m-p/1856903#M22436</guid>
      <dc:creator>Ricardo_Zamora</dc:creator>
      <dc:date>2024-04-29T17:11:39Z</dc:date>
    </item>
  </channel>
</rss>

