Go Down

Topic: how to change the color of pin number in Arduino IDE? (Read 1 time) previous topic - next topic

smilem

Dec 07, 2013, 06:45 am Last Edit: Dec 07, 2013, 06:56 am by smilem Reason: 1
Hello,

I have this like of code:

int water_pump = 2;
The text "water_pump = 2;" is all same color, I would like to have number "2" representing pin number another color.
How can I change this, I edited the theme.txt, but can't find this?

Also the preferences.txt file line

# anti-aliased text, turned off by default
editor.antialias=true

Changing it makes no change either.

robtillaart

you can use an external editor like notepad++ (to be configured in the preferences)
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

smilem


you can use an external editor like notepad++ (to be configured in the preferences)


Then it's more easy to use MariaMole or UECIDE, but I want to use Arduino IDE, while they make nice opensource hardware what's wrong with their software? Seems like one man job, why no bug fixes?

Grumpy_Mike

Because it is a stupid thing to want to do. It serves no purpose and only adds extra bytes in the source code that need to be removed before it will compile. Yes a one man job but for how long?

bperrybap

#4
Jan 02, 2014, 10:03 pm Last Edit: Jan 02, 2014, 10:05 pm by bperrybap Reason: 1
Well there is a way to do color highlighting in the IDE.
It is controlled by the keywords.txt
the one in {installdir}/lib/keywords.txt is the global one
and you can create one for each sketch if you put a keywords.txt file
in the same directory as your sketch or library.

The problem is with the use of naked constants.
If the Arduino team had used named defines or constants rather than naked constants
for the digital pins, this, along with many other issues could easily be resolved.

So for example, they have named constants in the variant files.
While there wasn't really a naming convention, at least there are
some named constants.
Names like:
A0, A1, etc... for the analog pins.
SS, MOSI, SCK, SDA, SCL, etc...

Unfortunately the Arduino team didn't put those names in the
common keywords.txt file so they won't highlight
AND there are no named constants for the Arduino digital pins.

The problem with naked constants is that there is no way to tell the difference
between, well a number, and a reference to an Arduino digital pin.

So while you might like to see a 2 highlighted when you are using it as a digital pin
you probably don't want to see that same highlighting when you use a 2 in a mathematical
expression.


If you are ambitious you could define a set pin names for all your digital pins
and the put those names into a keywords.txt file, then use
your named pins in your sketch.
Then, you would see the color change for the references to your named pins
but not for the naked constants, which is more than likely what you really
are wanting.


--- bill


Go Up