# My nano every blinks tx with no code, and also can you help me with my current code it isnt working

**URL:** <https://forum.arduino.cc/t/my-nano-every-blinks-tx-with-no-code-and-also-can-you-help-me-with-my-current-code-it-isnt-working/1346496>\
**Category:** Sensors\
**Created:** [January 24, 2025, 6:13pm UTC](https://forum.arduino.cc/t/my-nano-every-blinks-tx-with-no-code-and-also-can-you-help-me-with-my-current-code-it-isnt-working/1346496 "2025-01-24T18:13:24Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![masteryoyo36fg](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/masteryoyo36fg/32/1183568_2.png) [@masteryoyo36fg](https://forum.arduino.cc/u/masteryoyo36fg)\
**Post date:** [January 24, 2025, 6:13pm UTC](https://forum.arduino.cc/t/my-nano-every-blinks-tx-with-no-code-and-also-can-you-help-me-with-my-current-code-it-isnt-working/1346496/1 "2025-01-24T18:13:24Z")

</div>

```arduino
// defines pin numbers
const int trigPin = 2;
const int echoPin = 3;
const int buzzer = 4;
const int ledPin = 5;

// defines variables
long duration;
int distance;
int safetyDistance;

void setup() {
    pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
    pinMode(echoPin, INPUT); // Sets the echoPin as an Input
    pinMode(buzzer, OUTPUT);
    pinMode(ledPin, OUTPUT);
    Serial.begin(9600); // Starts the serial communication
}

void loop() {
    // Clears the trigPin
    digitalWrite(trigPin, LOW);
    delayMicroseconds(2);

    // Sets the trigPin on HIGH state for 10 microseconds
    digitalWrite(trigPin, HIGH);
    delayMicroseconds(10);
    digitalWrite(trigPin, LOW);

    // Reads the echoPin, returns the sound wave travel time in microseconds
    duration = pulseIn(echoPin, HIGH);

    // Calculating the distance
    distance = duration * 0.0343 / 2;

    safetyDistance = distance;
    if (safetyDistance <= 14) {
        digitalWrite(buzzer, HIGH);
        digitalWrite(ledPin, HIGH);
    } else {
        digitalWrite(buzzer, LOW);
        digitalWrite(ledPin, LOW);
    }

    // Prints the distance on the Serial Monitor
    Serial.print("Distance: ");
    Serial.println(distance);
}

```

---

<div class="post-metadata">

**Author:** ![sonofcy](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sonofcy/32/1283617_2.png) [@sonofcy](https://forum.arduino.cc/u/sonofcy)\
**Post date:** [January 24, 2025, 6:16pm UTC](https://forum.arduino.cc/t/my-nano-every-blinks-tx-with-no-code-and-also-can-you-help-me-with-my-current-code-it-isnt-working/1346496/2 "2025-01-24T18:16:25Z")

</div>

The tx blnks because the factory loaded a blink sketch. If we can't see the verbose output of the compile in code tags, and some debug print output it is very difficult to help.

---

<div class="post-metadata">

**Author:** ![masteryoyo36fg](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/masteryoyo36fg/32/1183568_2.png) [@masteryoyo36fg](https://forum.arduino.cc/u/masteryoyo36fg)\
**Post date:** [January 24, 2025, 6:17pm UTC](https://forum.arduino.cc/t/my-nano-every-blinks-tx-with-no-code-and-also-can-you-help-me-with-my-current-code-it-isnt-working/1346496/3 "2025-01-24T18:17:45Z")

</div>

> [@sonofcy](#):
>
> blnks because the factory loaded a blink sketch. If we can't see the verbose output of the compile in code tags, and some debug print output it is very difficult to help.

rdude: Version 6.3-20190619  
Copyright (c) 2000-2005 Brian Dean, [http://www.bdmicro.com/](http://www.bdmicro.com/)  
Copyright (c) 2007-2014 Joerg Wunsch

```
     System wide configuration file is "C:\Users\pleas\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

     Using Port : COM3
     Using Programmer : jtag2updi
     Overriding Baud Rate : 115200

```

JTAG ICE mkII sign-on message:  
Communications protocol version: 1  
M\_MCU:  
boot-loader FW version: 1  
firmware version: 1.07  
hardware version: 1  
S\_MCU:  
boot-loader FW version: 1  
firmware version: 6.07  
hardware version: 1  
Serial number: 00:00:00:00:00:00  
Device ID: JTAGICE mkII  
AVR Part : ATmega4809  
Chip Erase delay : 0 us  
PAGEL : P00  
BS2 : P00  
RESET disposition : dedicated  
RETRY pulse : SCK  
serial program mode : yes  
parallel program mode : yes  
Timeout : 0  
StabDelay : 0  
CmdexeDelay : 0  
SyncLoops : 0  
ByteDelay : 0  
PollIndex : 0  
PollValue : 0x00  
Memory Detail :

```
                              Block Poll Page Polled
       Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
       ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
       signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
       prodsig 0 0 0 0 no 61 61 0 0 0 0x00 0x00
       fuses 0 0 0 0 no 9 0 0 0 0 0x00 0x00
       fuse0 0 0 0 0 no 1 0 0 0 0 0x00 0x00
       fuse1 0 0 0 0 no 1 0 0 0 0 0x00 0x00
       fuse2 0 0 0 0 no 1 0 0 0 0 0x00 0x00
       fuse4 0 0 0 0 no 1 0 0 0 0 0x00 0x00
       fuse5 0 0 0 0 no 1 0 0 0 0 0x00 0x00
       fuse6 0 0 0 0 no 1 0 0 0 0 0x00 0x00
       fuse7 0 0 0 0 no 1 0 0 0 0 0x00 0x00
       fuse8 0 0 0 0 no 1 0 0 0 0 0x00 0x00
       lock 0 0 0 0 no 1 0 0 0 0 0x00 0x00
       data 0 0 0 0 no 0 0 0 0 0 0x00 0x00
       usersig 0 0 0 0 no 64 64 0 0 0 0x00 0x00
       flash 0 0 0 0 no 49152 128 0 0 0 0x00 0x00
       eeprom 0 0 0 0 no 256 64 0 0 0 0x00 0x00

     Programmer Type : JTAGMKII_PDI
     Description : JTAGv2 to UPDI bridge
     M_MCU hardware version: 1
     M_MCU firmware version: 1.07
     S_MCU hardware version: 1
     S_MCU firmware version: 6.07
     Serial number: 00:00:00:00:00:00
     Vtarget : 5.0 V

```

avrdude: jtagmkII\_initialize(): Cannot locate "flash" and "boot" memories in description  
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.27s

avrdude: Device signature = 0x1e9651 (probably m4809)  
avrdude: erasing chip  
avrdude: reading input file "C:\Users\pleas\AppData\Local\arduino\sketches\619370A176413873A8C321B735A3A4AB/smart\_glasses.ino.hex"  
avrdude: writing flash (4008 bytes):

Writing | ################################################## | 100% 2.99s

avrdude: 4008 bytes of flash written  
avrdude: reading input file "0x01"  
avrdude: writing fuse2 (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of fuse2 written  
avrdude: reading input file "0xC9"  
avrdude: writing fuse5 (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of fuse5 written  
avrdude: reading input file "0x00"  
avrdude: writing fuse8 (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of fuse8 written

avrdude done. Thank you.

---

<div class="post-metadata">

**Author:** ![LarryD](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/larryd/32/215550_2.png) [@LarryD](https://forum.arduino.cc/u/LarryD)\
**Post date:** [January 24, 2025, 6:21pm UTC](https://forum.arduino.cc/t/my-nano-every-blinks-tx-with-no-code-and-also-can-you-help-me-with-my-current-code-it-isnt-working/1346496/4 "2025-01-24T18:21:11Z")

</div>

# [My nano every blinks tx with no code,](https://forum.arduino.cc/t/my-nano-every-blinks-tx-with-no-code-and-also-can-you-help-me-with-my-current-code-it-isnt-working/1346496)

```arduino

    // Prints the distance on the Serial Monitor
    Serial.print("Distance: ");
    Serial.println(distance);

```

- You are sending text out **every time** loop( ) runs.

---

<div class="post-metadata">

**Author:** ![sonofcy](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sonofcy/32/1283617_2.png) [@sonofcy](https://forum.arduino.cc/u/sonofcy)\
**Post date:** [January 24, 2025, 6:21pm UTC](https://forum.arduino.cc/t/my-nano-every-blinks-tx-with-no-code-and-also-can-you-help-me-with-my-current-code-it-isnt-working/1346496/5 "2025-01-24T18:21:33Z")

</div>

> [@masteryoyo36fg](#):
>
> ` distance = duration * 0.0343 / 2;`

You should add some specific casts, otherwise you have  
int = long \* float / int  
Do you think there might be a problem with that?

---

<div class="post-metadata">

**Author:** ![masteryoyo36fg](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/masteryoyo36fg/32/1183568_2.png) [@masteryoyo36fg](https://forum.arduino.cc/u/masteryoyo36fg)\
**Post date:** [January 24, 2025, 6:22pm UTC](https://forum.arduino.cc/t/my-nano-every-blinks-tx-with-no-code-and-also-can-you-help-me-with-my-current-code-it-isnt-working/1346496/6 "2025-01-24T18:22:27Z")

</div>

im not really that good at coding so i wouldnt really understand

---

<div class="post-metadata">

**Author:** ![sonofcy](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sonofcy/32/1283617_2.png) [@sonofcy](https://forum.arduino.cc/u/sonofcy)\
**Post date:** [January 24, 2025, 6:30pm UTC](https://forum.arduino.cc/t/my-nano-every-blinks-tx-with-no-code-and-also-can-you-help-me-with-my-current-code-it-isnt-working/1346496/7 "2025-01-24T18:30:53Z")

</div>

Before you try to write code, you need to understand number systems, number representation and how/if you can convert between them.

If pulsein really returns long, convert the long to float in the next statement then do that formula correctly all in float.

---

<div class="post-metadata">

**Author:** ![sterretje](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sterretje/32/391294_2.png) [@sterretje](https://forum.arduino.cc/u/sterretje)\
**Post date:** [January 25, 2025, 8:22am UTC](https://forum.arduino.cc/t/my-nano-every-blinks-tx-with-no-code-and-also-can-you-help-me-with-my-current-code-it-isnt-working/1346496/8 "2025-01-25T08:22:47Z")

</div>

> [@sonofcy](#):
>
> The tx blnks because the factory loaded a blink sketch.

The blink sketch blinks the L-LED, not the TX LED.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [July 24, 2025, 8:23am UTC](https://forum.arduino.cc/t/my-nano-every-blinks-tx-with-no-code-and-also-can-you-help-me-with-my-current-code-it-isnt-working/1346496/9 "2025-07-24T08:23:38Z")

</div>

Closed on July 24, 2025, 8:23am UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
