What does the black type mean?

I have background in Basic, Fortran, Assembly, machine language, and C++ from 40 years ago.

The following code segment comes from: EthernetUDPInterface.ino

UDP
// This class enables UDP messages to be sent and received.
// EXAMPLE USAGE
SerialLogHandler logHandler;
// UDP Port used for two way communication
unsigned int localPort = 8888;
// An UDP instance to let us send and receive packets over UDP
// end start the UDP
// start UDP
UDP Udp;

UDP, SerialLogHandler logHandler;, and UDP Udp; are all displayed in black type. I don't understand what any of them do. In other languages, UDP could be a marker, indicating where the code could jump to. When you have words separated by a space (SerialLogHandler logHandler; and UDP Udp;), I don't have a clue what that means. Why isn't UDP followed by a semi-colon?

Please post the whole sketch so that we don't have to guess exactly which one you are asking about

2 Likes

Where did you get EthernetUDPInterface.ino from?

In this snippet, the first UDP looks suspicious.

Think of them (UDP, SerialLogHandler) as types, and the last UDP Udp; makes a thing called Udp of type UDP. The first UDP looks odd, like a bare int would look.

1 Like

With all that background you understand how important it is to be able to read the code that needs to be debugged. Start by following the forum guidelines and post the code using code tag. What black type are you referring, everything you posted is black on a white screen.

1 Like

@gilshultz Unfortunately, he'll need to post an image of the IDE, in order to see text colours, and we often disparage those who post code that way. In this case, it's necessary.

3 Likes


Sorry, this code originally came from ethernetInterfaceUDPLib.ino.

Line 12 is extremely suspect without seeing what's above it, and since it's a .ino file, you could get better help by simply copy-for-forum and paste into a message. We can copy it to our IDE then, and see what it is you're really seeing.

1 Like

Searching the internet using some keywords from your sketch I came across this site

https://docs.particle.io/reference/device-os/api/udp/udp/

that uses exactly the same comments and lines you posted. However it looks like aiming at different products than Arduino boards called "particle hardware" or "particle devices". The inclusion of libraries seems to be handled differently in the particle IDE than in the Arduino IDE.

Could you probably post the link to the website where you found the ino file?

1 Like

On my computer everything is white on a black screen

Please stop posting screenshots of code

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum

From:

...it looks like it might be part of a bad cut-and paste:


...

Please review the comment from Camsysca.
It might help if you read ALL the commentary.

@fester225

What is so difficult about posting the complete sketch as a code-section if you have this knowledge:

?
Here is a tutorial with screenshots how to do it

I'm sure that @UKHeliBob did that. The first request for screenshot was made so we could see what you meant regarding the colours. After that you could just have posted the code.

You did post your code in the opening post; it however is a snippet so most of us can't relate to it; you did refer to EthernetUDPInterface.ino and we possibly might not have that file on our system. Therefore we like to see complete code.

Thanks for trying to use code tags; it did not quite work out. I've fixed it for you.

Code tags are three backticks on a line (```) and they must be on their own line.
```
your code
```

1 Like

Hi @DaveX,

I guess the reason might be the way how the particle reference lists the code. I'm not familiar with the particle IDE but on a first glance it looks that it provides a function where the user chooses the required lib and the appropriate #include line is automatically inserted.

@fester225:

Are you using the particle IDE or the Arduino IDE? If it's the Arduino IDE you have to install the required libraries and include them yourself in the sketch.

Could you please also post which hardware you use? The IDE you use must be able to support this hardware also.

1 Like

Thank you.

Here is a screenshot of that actual web page:

It does seem like some copy-paste errors: nowhere on that page does UDP appear alone on a line - it is always in a statement such as UDP Udp;

@awneil Actually, it does appear in that image - as a title several lines above the subtitle "// EXAMPLE USAGE". That makes me think that someone has done a cut-and-paste of the text of the entire screen, then mis-edited to remove some extraneous content but left "UDP" dangling on it's own at the top.
Clearly, out-of-context, and will not compile, but hey, it's there.

1 Like

I don't see it on the https://docs.particle.io/reference/device-os/api/udp/ page?

(https://docs.particle.io/reference/device-os/api/udp/ redirects immediately to https://docs.particle.io/reference/device-os/api/udp/udp/)