Using <> after IDE 2.0.0 Copy for Forum (Markdown)
```cpp int8_t PCintPort::addPin(uint8_t arduinoPin, PCIntvoidFuncPtr userFunc, uint8_t mode) { PCintPin* tmp; tmp=firstPin; if (firstPin != NULL) { do { if (tmp->arduinoPin == arduinoPin) { enable(tmp, userFunc, mode); return(0); } if (tmp->next == NULL) break; tmp=tmp->next; } while (true); } ```
Using {;} after IDE 2.0.0 Copy for Forum (Markdown)
```cpp int8_t PCintPort::addPin(uint8_t arduinoPin, PCIntvoidFuncPtr userFunc, uint8_t mode) { PCintPin* tmp; tmp=firstPin; if (firstPin != NULL) { do { if (tmp->arduinoPin == arduinoPin) { enable(tmp, userFunc, mode); return(0); } if (tmp->next == NULL) break; tmp=tmp->next; } while (true); } ```
Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting
Following the HELP steps. Simple select and copy from source, paste into here after a couple blank lines and add a couple blank lines after.
const char*macToString(uint8_tmac[6]) { staticchars[20]; sprintf(s, "%02X:%02X:%02X:%02X:%02X:%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); return s; }
Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting
Using <> after IDE 2.0.0 Copy for Forum (Markdown)
```cpp int8_t PCintPort::addPin(uint8_t arduinoPin, PCIntvoidFuncPtr userFunc, uint8_t mode) { PCintPin* tmp; tmp=firstPin; if (firstPin != NULL) { do { if (tmp->arduinoPin == arduinoPin) { enable(tmp, userFunc, mode); return(0); } if (tmp->next == NULL) break; tmp=tmp->next; } while (true); } ```Using {;} after IDE 2.0.0 Copy for Forum (Markdown)
```cpp int8_t PCintPort::addPin(uint8_t arduinoPin, PCIntvoidFuncPtr userFunc, uint8_t mode) { PCintPin* tmp; tmp=firstPin; if (firstPin != NULL) { do { if (tmp->arduinoPin == arduinoPin) { enable(tmp, userFunc, mode); return(0); } if (tmp->next == NULL) break; tmp=tmp->next; } while (true); } ```
As I mentioned else thread... the new Arduino IDE does not offer saving your code to HTML - I don't know why, but if you have an account, I'm sure they will look at any enhancement requests put to them, as their issue tracker seems to have many enhancement requests already recorded on their GitHub site.
Cheers
Following the HELP instructions on code posting, I never did it this way.
/* Blink Turns an LED on for one second, then off for one second, repeatedly. Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to the correct LED pin independent of which board is used. If you want to know what pin the on-board LED is connected to on your Arduino model, check the Technical Specs of your board at: https://www.arduino.cc/en/Main/Products modified 8 May 2014 by Scott Fitzgerald modified 2 Sep 2016 by Arturo Guadalupi modified 8 Sep 2016 by Colby Newman This example code is in the public domain. https://www.arduino.cc/en/Tutorial/BuiltInExamples/Blink */ // the setup function runs once when you press reset or power the board void setup() { // initialize digital pin LED_BUILTIN as an output. pinMode(LED_BUILTIN, OUTPUT); } // the loop function runs over and over again forever void loop() { digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second }
Now use the IDE copy for forum
```cpp // the setup function runs once when you press reset or power the board void setup() { // initialize digital pin LED_BUILTIN as an output. pinMode(LED_BUILTIN, OUTPUT); } // the loop function runs over and over again forever void loop() { digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second } ```
Don't see much difference.
Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting
Following the HELP instructions on code posting, I never did it this way.
/* Blink Turns an LED on for one second, then off for one second, repeatedly. Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to the correct LED pin independent of which board is used. If you want to know what pin the on-board LED is connected to on your Arduino model, check the Technical Specs of your board at: https://www.arduino.cc/en/Main/Products modified 8 May 2014 by Scott Fitzgerald modified 2 Sep 2016 by Arturo Guadalupi modified 8 Sep 2016 by Colby Newman This example code is in the public domain. https://www.arduino.cc/en/Tutorial/BuiltInExamples/Blink */ // the setup function runs once when you press reset or power the board void setup() { // initialize digital pin LED_BUILTIN as an output. pinMode(LED_BUILTIN, OUTPUT); } // the loop function runs over and over again forever void loop() { digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second }Now use the IDE copy for forum
```cpp // the setup function runs once when you press reset or power the board void setup() { // initialize digital pin LED_BUILTIN as an output. pinMode(LED_BUILTIN, OUTPUT); } // the loop function runs over and over again forever void loop() { digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second } ```Don't see much difference.
The [CODE] tag preserves whitespace, that's all, no syntax highlighting... so, if you format your code in the Arduino IDE just the way you like it, then select it all, and copy for forum, and then... select the "<>" menu option on the forum, and paste your code in there... it will then be displayed with all the whitespace and indentation you intended it to look like.
Cheers
The [CODE] tag preserves whitespace, that's all, no syntax highlighting... so, if you format your code in the Arduino IDE just the way you like it, then select it all, and copy for forum, and then... select the "<>" menu option on the forum, and paste your code in there... it will then be displayed with all the whitespace and indentation you intended it to look like.
Cheers
Interestingly, the Arduino IDE 2 has the ability to copy formatted code, if the editor you're pasting into supports it - Try copy some code directly into LibreOffice Writer for example, or use the "Paste Special" option to see some options.
Cheers