Pinguino Forum

Full Version: [SOLVED] println() doesn't print anything
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello guys,
I've got a problem with the Serial function println().
I don't know where it should be displayed but println() does not print anything in the terminal where the Pinguino IDE was launched or in the IDE's console.

I have tested my the current flow on my breadboard and everything seems okay (I did it with a led).

OS + distro: GNU/Linux Arch Linux (updated 2 days ago)
Board: PIC32-Pinguino-MX220 (from Olimex)
Additional info: The pins 7 & 8 are respectively the Trigger & Echo of my HC-SR04 ultrasonic module.

Here's the code :

main.pde :
#define trigPin 7
#define echoPin 8

long duration;
long distance;

void setup()
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);

void loop()
  digitalWrite(trigPin, LOW);

  digitalWrite(trigPin, HIGH);

  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH, 1000);

  distance = duration/58.2;



(Based on this example)
Where did I failed ?

Flaco Smile
Do you mean to debug, like the Arduino serial monitor ?!
Hi (again)!

It's getting late here so I'll try tomorrow. Smile
Thanks for the link (and it seems to be an interesting blog Big Grin )

Do you know the differences between CDC & Serial ?

Flaco Smile
CDC should be over the USB cable. Serial is RS232 (COM port stuff).

I use CDC.printf all the time Smile

Hey pingotg; it's been quite a long time. I hope you're doing well. Big Grin
Thank you for the tip. I will use it errr'y time now. Smile

Thanks to you guys!
You're welcome.

I download to the board and then watch the debug CDC.printf data from my app.

It's /dev/ttyACM0 on Linux.

Easy to do with or without the IDE.

I'm back. Code tested, I've got some issues. :/

First: Nothing is displayed.

I have tested this code :

void setup() {
  // put your setup code here, to run once:


void loop() {
  // put your main code here, to run repeatedly:
  CDC.println("\n\r Hello World!!!");

Second: My code doesn't compile but since I'm not totally sober at this time. I'll try to debug it later, hahaha.

See you guys,
Flaco Smile

EDIT: I can't find the indicated path in your link :/

Quote:Step 4: Select Menu->Pinguino->Debug Mode->USB CDC And on the bottom section the port x on which the device is connected and there you go:

I just have "File" (Fichier) "Edit" (Editer) "View" (Vue) "Send to Pinguino" (Envoyer vers Pinguino) and "Help" (Aide)
I didn't find any "Pinguino" sub-menu. (I have taken a look at the "Configuration..." sub-window as well).
On mine it's under the Pinguino menu item, but I don't use it. I prefer to use a terminal emulator (as Linux calls them) in a separate window. (I use the "screen" command.)

I put a small delay in my pde after the first CDC.printf as that creates the ttyACM0 device and I like to have a moment to run screen.

The first bit of output tends to get lost as I suppose it's sent during the time I'm starting screen.

It's so convenient that I've never bothered to improve it. ("It ain't broke so don't fix it.")

Hello John,
I read more carefully your second answer and I see that CDC.printf() writes in /dev/TTYACM0. Right?

How can I access/read this file (preferably in real-time) ?
I have tried with Emacs but it tells me "File exists, but cannot be read". Any tip ?


EDIT: Found it! sudo cat /dev/ttyACM0 works very well.
Thank you so much man! Smile
Well done!

Longer term, if you look at the owner of /dev/ttyACM0 (which will probably be dialout or plugdev or the like), you can add your login to the groups allowed to access it, then you won't need the sudo

Something like usermod -G plugdev -a loginname

(you need to log out and back in after that for the new group to be in force)

When that works, you should also be able to view the CDC prints from the IDE. I'm happy with screen, though.