Pages: [1]   Go Down
Author Topic: how to change the color of pin number in Arduino IDE?  (Read 1474 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: December 07, 2013, 12:56:08 am by smilem » Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 217
Posts: 13707
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Rob Tillaart

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

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 626
Posts: 34164
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Dallas, TX USA
Offline Offline
Faraday Member
**
Karma: 67
Posts: 2702
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

« Last Edit: January 02, 2014, 04:05:15 pm by bperrybap » Logged

Pages: [1]   Go Up
Jump to: