Serial monitor not working Properly

Am using Baron and VScode as editor.
Compile and flashing locally are working perfectly without any issue but serial monitor is not responding perfectly.
the code are good but serial showing as responsive but not.

Is anyone here how can help …? thanks

Welcome to the community!

What does the code do?
What are you expecting it to do?

2 Likes

You may also want to update your device - 0.8.0-rc.27 is long gone :wink:

BTW, if we ever got 1cent for each time this was said but not really true, we’d be rich

2 Likes

@Moors7 The code is for reading NFC card and tags , and i was expecting to see serial number of the card but nothing happen when i swapped the card to the reader.
to double check if it’s not connection i tried to write a simple code of counter again when i open serial monitor nothing displayed.

@ScruffR which version do you recommend …?

Could you show us that code please? Like @ScruffR mentioned, the ratio of people who think their code is flawless vs the amount of times that turned out to be untrue, is rather high.

The latest.

2 Likes

0.9.0 is the officially released version - anything prior to that was only prerelease.

#include <Wire.h>
#include <Adafruit_PN532.h>

#define PN532_IRQ   (2)
#define PN532_RESET (3)

Adafruit_PN532 nfc(PN532_IRQ, PN532_RESET);

void setup(void) {
  Serial.begin(115200);
  nfc.begin();
  uint32_t versiondata = nfc.getFirmwareVersion();
  if (! versiondata) {
    Serial.print("Didn't find PN53x board");
    while (1); // halt
  }
  Serial.print("Found chip PN5");
  Serial.println((versiondata >> 24) & 0xFF, HEX); 
  nfc.SAMConfig();
  Serial.println("Waiting for card...");
}

void loop(void) {
  readCard();
}

void readCard(){
  uint8_t success;
  uint8_t uid[] = { 0, 0, 0, 0, 0, 0, 0 };
  uint8_t uidLength;
  success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLength);
  if (success) {
    if (uidLength == 4)
    {
      uint32_t cardid = uid[0];
      cardid <<= 8;
      cardid |= uid[1];
      cardid <<= 8;
      cardid |= uid[2];  
      cardid <<= 8;
      cardid |= uid[3]; 
      Serial.print("Found Mifare Classic card #");
      Serial.println(cardid,HEX);
    }
    delay(1000);
  }
}

that’s the code for NFC but for checking if it’s not nfc or connection i tried this and nothing changed

int counter = 0;

void setup() {
	Serial.begin(9600);
}

void loop() {
	Serial.printlnf("testing %d", ++counter);
	delay(1000);
}

@Moors7 :point_up_2:

Are you absolutely sure the device actually took that code and is running it?
Can you slightly adapt your test code this way and see whether the blue LED starts to blink after flashing this?

int counter = 0;

void setup() {
	Serial.begin(9600);
	pinMode(D7, OUTPUT);
}

void loop() {
	Serial.printlnf("testing %d", ++counter);
	digitalWrite(D7, !digitalRead(D7));
	delay(1000);
}

Also make sure that you don’t have any other Particle device plugged in at the same time so that particle serial monitor doesn’t pick the wrong device by accident.

I tried but it’s looks like device is not responsive, Does anyone who can help me cause even Led is not ON and in terminal looks like flashing is successful.

Put your Boron into Listening Mode and run particle serial inspect and post the result.
You also want to run
CTRL+Shift+P

image

And set the target version to 0.9.0

Next, what does the RGB LED do on your device?
If it’s not breathing cyan like shown here your code will never start to run.

After running particle serial inspect this is the notification

Device is already on version to 0.9.0 and target version is 0.9.0 but am not flash through internet (FYI) am using local compile and flashing

Issue still there nothing changed

And how about that?

RGB is green is not cyan

before i flash the code to device RGB Led is dark blue as in listening mode and then after flashing the RGB Led turning blinking Green

That perfectly explains why you don’t see any serial ouput because your code never starts running.

When you flash this code it will

SYSTEM_MODE(SEMI_AUTOMATIC);

int counter = 0;

void setup() {
	Serial.begin(9600);
	pinMode(D7, OUTPUT);
}

void loop() {
	Serial.printlnf("testing %d", ++counter);
	digitalWrite(D7, !digitalRead(D7));
	delay(1000);
}

@ScruffR Thanks it works,
anyway what does SYSTEM_MODE(SEMI_AUTOMATIC) do…?
does it mean i should always start my code with this line…?

The docs can be found here
https://docs.particle.io/reference/device-os/firmware/boron/#system-modes

Actually your device should be able to enter “breathing cyan” at some point. Without that there is little use in spending the extra money for a cellular device if you never connect it to the internet.