Notifications
Clear all

Post code test

19 Posts
3 Users
1 Reactions
1,577 Views
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 8047
Topic starter  

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); } ```

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
Quote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 8047
Topic starter  

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;
}
 

 

 

 

 

 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 6 years ago
Posts: 1458
 

@zander

Posted by: @zander

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


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 8047
Topic starter  

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.

 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 6 years ago
Posts: 1458
 

@zander

Posted by: @zander

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

 


   
Ron reacted
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 6 years ago
Posts: 1458
 

@zander

Posted by: @frogandtoad

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


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 8047
Topic starter  

Using both the <> (Code) tag above and the {;} (Source Code) tag above to show the difference.

Clearly for the new IDE 2, the <> (Code) tag is better. However with no copy as HTML, we have lost the color coding.

First the <>

#include <IBusBM.h>

IBusBM IBus;  // IBus object

/*
  For a given ESP32 serial port. rxPin and txPin can be specified for the serial ports 1 and 2 of ESP32 architectures 
  (default to RX1=9, TX1=10, RX2=16, TX2=17).
*/

//#define RX2  16

/*
  Read the number of a given channel and convert to the range provided.
  If the channel is off, return the default value
*/

int readChannel(byte channelInput, int minLimit, int maxLimit, int defaultValue) {
  uint16_t ch = IBus.readChannel(channelInput);
  if (ch < 100) return defaultValue;
  return map(ch, 1000, 2000, minLimit, maxLimit);
}

// Read the channel and return a boolean value
bool readSwitch(byte channelInput, bool defaultValue) {
  int intDefaultValue = (defaultValue) ? 100 : 0;
  int ch = readChannel(channelInput, 0, 100, intDefaultValue);
  return (ch > 50);
}
void setup() {
  // Start serial monitor
  Serial.begin(115200);
  IBus.begin(Serial2, 1);  // iBUS object connected to serial2 RX2 pin using timer 1
}
void loop(){}

Second the {;}

#include IBusBM IBus; // IBus object /* For a given ESP32 serial port. rxPin and txPin can be specified for the serial ports 1 and 2 of ESP32 architectures (default to RX1=9, TX1=10, RX2=16, TX2=17). */ //#define RX2 16 /* Read the number of a given channel and convert to the range provided. If the channel is off, return the default value */ int readChannel(byte channelInput, int minLimit, int maxLimit, int defaultValue) { uint16_t ch = IBus.readChannel(channelInput); if (ch < 100) return defaultValue; return map(ch, 1000, 2000, minLimit, maxLimit); } // Read the channel and return a boolean value bool readSwitch(byte channelInput, bool defaultValue) { int intDefaultValue = (defaultValue) ? 100 : 0; int ch = readChannel(channelInput, 0, 100, intDefaultValue); return (ch > 50); } void setup() { // Start serial monitor Serial.begin(115200); IBus.begin(Serial2, 1); // iBUS object connected to serial2 RX2 pin using timer 1 } void loop(){}

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 8047
Topic starter  

Now the same test using IDE 1. The IDE copy was copy as HTML which is no longer available, so before the {;} was preferred but now <> is preferred.

First the <>

<pre>
<font color="#5e6d03">#include</font> <font color="#434f54">&lt;</font><font color="#000000">IBusBM</font><font color="#434f54">.</font><font color="#000000">h</font><font color="#434f54">&gt;</font>

<font color="#000000">IBusBM</font> <font color="#000000">IBus</font><font color="#000000">;</font> &nbsp;<font color="#434f54">// IBus object</font>

<font color="#95a5a6">/*</font>
<font color="#95a5a6"> &nbsp;For a given ESP32 serial port. rxPin and txPin can be specified for the serial ports 1 and 2 of ESP32 architectures </font>
<font color="#95a5a6"> &nbsp;(default to RX1=9, TX1=10, RX2=16, TX2=17).</font>
<font color="#95a5a6">*/</font>

<font color="#434f54">//#define RX2 &nbsp;16</font>

<font color="#95a5a6">/*</font>
<font color="#95a5a6"> &nbsp;Read the number of a given channel and convert to the range provided.</font>
<font color="#95a5a6"> &nbsp;If the channel is off, return the default value</font>
<font color="#95a5a6">*/</font>

<font color="#00979c">int</font> <font color="#000000">readChannel</font><font color="#000000">(</font><font color="#00979c">byte</font> <font color="#000000">channelInput</font><font color="#434f54">,</font> <font color="#00979c">int</font> <font color="#000000">minLimit</font><font color="#434f54">,</font> <font color="#00979c">int</font> <font color="#000000">maxLimit</font><font color="#434f54">,</font> <font color="#00979c">int</font> <font color="#000000">defaultValue</font><font color="#000000">)</font> <font color="#000000">{</font>
 &nbsp;<font color="#00979c">uint16_t</font> <font color="#000000">ch</font> <font color="#434f54">=</font> <font color="#000000">IBus</font><font color="#434f54">.</font><font color="#000000">readChannel</font><font color="#000000">(</font><font color="#000000">channelInput</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#5e6d03">if</font> <font color="#000000">(</font><font color="#000000">ch</font> <font color="#434f54">&lt;</font> <font color="#000000">100</font><font color="#000000">)</font> <font color="#5e6d03">return</font> <font color="#000000">defaultValue</font><font color="#000000">;</font>
 &nbsp;<font color="#5e6d03">return</font> <font color="#d35400">map</font><font color="#000000">(</font><font color="#000000">ch</font><font color="#434f54">,</font> <font color="#000000">1000</font><font color="#434f54">,</font> <font color="#000000">2000</font><font color="#434f54">,</font> <font color="#000000">minLimit</font><font color="#434f54">,</font> <font color="#000000">maxLimit</font><font color="#000000">)</font><font color="#000000">;</font>
<font color="#000000">}</font>

<font color="#434f54">// Read the channel and return a boolean value</font>
<font color="#00979c">bool</font> <font color="#000000">readSwitch</font><font color="#000000">(</font><font color="#00979c">byte</font> <font color="#000000">channelInput</font><font color="#434f54">,</font> <font color="#00979c">bool</font> <font color="#000000">defaultValue</font><font color="#000000">)</font> <font color="#000000">{</font>
 &nbsp;<font color="#00979c">int</font> <font color="#000000">intDefaultValue</font> <font color="#434f54">=</font> <font color="#000000">(</font><font color="#000000">defaultValue</font><font color="#000000">)</font> <font color="#434f54">?</font> <font color="#000000">100</font> <font color="#434f54">:</font> <font color="#000000">0</font><font color="#000000">;</font>
 &nbsp;<font color="#00979c">int</font> <font color="#000000">ch</font> <font color="#434f54">=</font> <font color="#000000">readChannel</font><font color="#000000">(</font><font color="#000000">channelInput</font><font color="#434f54">,</font> <font color="#000000">0</font><font color="#434f54">,</font> <font color="#000000">100</font><font color="#434f54">,</font> <font color="#000000">intDefaultValue</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#5e6d03">return</font> <font color="#000000">(</font><font color="#000000">ch</font> <font color="#434f54">&gt;</font> <font color="#000000">50</font><font color="#000000">)</font><font color="#000000">;</font>
<font color="#000000">}</font>
<font color="#00979c">void</font> <font color="#5e6d03">setup</font><font color="#000000">(</font><font color="#000000">)</font> <font color="#000000">{</font>
 &nbsp;<font color="#434f54">// Start serial monitor</font>
 &nbsp;<b><font color="#d35400">Serial</font></b><font color="#434f54">.</font><font color="#d35400">begin</font><font color="#000000">(</font><font color="#000000">115200</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#000000">IBus</font><font color="#434f54">.</font><font color="#d35400">begin</font><font color="#000000">(</font><b><font color="#d35400">Serial2</font></b><font color="#434f54">,</font> <font color="#000000">1</font><font color="#000000">)</font><font color="#000000">;</font> &nbsp;<font color="#434f54">// iBUS object connected to serial2 RX2 pin using timer 1</font>
<font color="#000000">}</font>
<font color="#00979c">void</font> <font color="#5e6d03">loop</font><font color="#000000">(</font><font color="#000000">)</font><font color="#000000">{</font><font color="#000000">}</font>

</pre>

 

Second the {;}

 

#include <IBusBM.h>

IBusBM IBus;  // IBus object

/*
  For a given ESP32 serial port. rxPin and txPin can be specified for the serial ports 1 and 2 of ESP32 architectures 
  (default to RX1=9, TX1=10, RX2=16, TX2=17).
*/

//#define RX2  16

/*
  Read the number of a given channel and convert to the range provided.
  If the channel is off, return the default value
*/

int readChannel(byte channelInput, int minLimit, int maxLimit, int defaultValue) {
  uint16_t ch = IBus.readChannel(channelInput);
  if (ch < 100) return defaultValue;
  return map(ch, 1000, 2000, minLimit, maxLimit);
}

// Read the channel and return a boolean value
bool readSwitch(byte channelInput, bool defaultValue) {
  int intDefaultValue = (defaultValue) ? 100 : 0;
  int ch = readChannel(channelInput, 0, 100, intDefaultValue);
  return (ch > 50);
}
void setup() {
  // Start serial monitor
  Serial.begin(115200);
  IBus.begin(Serial2, 1);  // iBUS object connected to serial2 RX2 pin using timer 1
}
void loop(){}

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 8047
Topic starter  

3rd test using Copy for Forum (Markdown) still no color.

case 1 <>

```cpp
#include <IBusBM.h>

IBusBM IBus;  // IBus object

/*
  For a given ESP32 serial port. rxPin and txPin can be specified for the serial ports 1 and 2 of ESP32 architectures 
  (default to RX1=9, TX1=10, RX2=16, TX2=17).
*/

//#define RX2  16

/*
  Read the number of a given channel and convert to the range provided.
  If the channel is off, return the default value
*/

int readChannel(byte channelInput, int minLimit, int maxLimit, int defaultValue) {
  uint16_t ch = IBus.readChannel(channelInput);
  if (ch < 100) return defaultValue;
  return map(ch, 1000, 2000, minLimit, maxLimit);
}

// Read the channel and return a boolean value
bool readSwitch(byte channelInput, bool defaultValue) {
  int intDefaultValue = (defaultValue) ? 100 : 0;
  int ch = readChannel(channelInput, 0, 100, intDefaultValue);
  return (ch > 50);
}
void setup() {
  // Start serial monitor
  Serial.begin(115200);
  IBus.begin(Serial2, 1);  // iBUS object connected to serial2 RX2 pin using timer 1
}
void loop(){}

```

 

Case 2 {;}

 

```cpp #include IBusBM IBus; // IBus object /* For a given ESP32 serial port. rxPin and txPin can be specified for the serial ports 1 and 2 of ESP32 architectures (default to RX1=9, TX1=10, RX2=16, TX2=17). */ //#define RX2 16 /* Read the number of a given channel and convert to the range provided. If the channel is off, return the default value */ int readChannel(byte channelInput, int minLimit, int maxLimit, int defaultValue) { uint16_t ch = IBus.readChannel(channelInput); if (ch < 100) return defaultValue; return map(ch, 1000, 2000, minLimit, maxLimit); } // Read the channel and return a boolean value bool readSwitch(byte channelInput, bool defaultValue) { int intDefaultValue = (defaultValue) ? 100 : 0; int ch = readChannel(channelInput, 0, 100, intDefaultValue); return (ch > 50); } void setup() { // Start serial monitor Serial.begin(115200); IBus.begin(Serial2, 1); // iBUS object connected to serial2 RX2 pin using timer 1 } void loop(){} ```

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 8047
Topic starter  

Test 4 using the Help method (Copy)

Case 1 <>

#include <IBusBM.h>


IBusBM IBus; // IBus object


/*
For a given ESP32 serial port. rxPin and txPin can be specified for the serial ports 1 and 2 of ESP32 architectures
(default to RX1=9, TX1=10, RX2=16, TX2=17).
*/


//#define RX2 16


/*
Read the number of a given channel and convert to the range provided.
If the channel is off, return the default value
*/


int readChannel(byte channelInput, int minLimit, int maxLimit, int defaultValue) {
uint16_t ch = IBus.readChannel(channelInput);
if (ch < 100) return defaultValue;
return map(ch, 1000, 2000, minLimit, maxLimit);
}


// Read the channel and return a boolean value
bool readSwitch(byte channelInput, bool defaultValue) {
int intDefaultValue = (defaultValue) ? 100 : 0;
int ch = readChannel(channelInput, 0, 100, intDefaultValue);
return (ch > 50);
}
void setup() {
// Start serial monitor
Serial.begin(115200);
IBus.begin(Serial2, 1); // iBUS object connected to serial2 RX2 pin using timer 1
}
void loop(){}

 

Case 2 {;}

#include <IBusBM.h>

IBusBM IBus; // IBus object

/*
For a given ESP32 serial port. rxPin and txPin can be specified for the serial ports 1 and 2 of ESP32 architectures
(default to RX1=9, TX1=10, RX2=16, TX2=17).
*/

//#define RX2 16

/*
Read the number of a given channel and convert to the range provided.
If the channel is off, return the default value
*/

int readChannel(byte channelInput, int minLimit, int maxLimit, int defaultValue) {
uint16_t ch = IBus.readChannel(channelInput);
if (ch < 100) return defaultValue;
return map(ch, 1000, 2000, minLimit, maxLimit);
}

// Read the channel and return a boolean value
bool readSwitch(byte channelInput, bool defaultValue) {
int intDefaultValue = (defaultValue) ? 100 : 0;
int ch = readChannel(channelInput, 0, 100, intDefaultValue);
return (ch > 50);
}
void setup() {
// Start serial monitor
Serial.begin(115200);
IBus.begin(Serial2, 1); // iBUS object connected to serial2 RX2 pin using timer 1
}
void loop(){}

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 8047
Topic starter  

Trying 2.1.0 IDE (Copy for Forum Markdown) using the <> code option. I think this is the best.

Screenshot 2023 04 21 at 10.35.32

 

```cpp
/*
    Your code description here
    (c) you, 20XX
    All rights reserved.

    Functionality: 
    
    Version log:
    
    20XX-MM-DD:
        v1.0.0  - Initial release
        
*/
// ==== DEFINES ===================================================================================

// ==== Debug and Test options ==================
#define _DEBUG_
//#define _TEST_

//===== Debugging macros ========================
#ifdef _DEBUG_
#define SerialD Serial
#define _PM(a) SerialD.print(millis()); SerialD.print(": "); SerialD.println(a)
#define _PP(a) SerialD.print(a)
#define _PL(a) SerialD.println(a)
#define _PX(a) SerialD.println(a, HEX)
#else
#define _PM(a)
#define _PP(a)
#define _PL(a)
#define _PX(a)
#endif




// ==== INCLUDES ==================================================================================

// ==== Uncomment desired compile options =================================
// ----------------------------------------
// The following "defines" control library functionality at compile time,
// and should be used in the main sketch depending on the functionality required
// Should be defined BEFORE #include <TaskScheduler.h>  !!!
//
// #define _TASK_TIMECRITICAL       // Enable monitoring scheduling overruns
// #define _TASK_SLEEP_ON_IDLE_RUN  // Enable 1 ms SLEEP_IDLE powerdowns between runs if no callback methods were invoked during the pass
// #define _TASK_STATUS_REQUEST     // Compile with support for StatusRequest functionality - triggering tasks on status change events in addition to time only
// #define _TASK_WDT_IDS            // Compile with support for wdt control points and task ids
// #define _TASK_LTS_POINTER        // Compile with support for local task storage pointer
// #define _TASK_PRIORITY           // Support for layered scheduling priority
// #define _TASK_MICRO_RES          // Support for microsecond resolution
// #define _TASK_STD_FUNCTION       // Support for std::function (ESP8266 ONLY)
// #define _TASK_DEBUG              // Make all methods and variables public for debug purposes
// #define _TASK_INLINE             // Make all methods "inline" - needed to support some multi-tab, multi-file implementations
// #define _TASK_TIMEOUT            // Support for overall task timeout
// #define _TASK_OO_CALLBACKS       // Support for callbacks via inheritance
// #define _TASK_EXPOSE_CHAIN       // Methods to access tasks in the task chain
// #define _TASK_SCHEDULING_OPTIONS // Support for multiple scheduling options
// #define _TASK_DEFINE_MILLIS      // Force forward declaration of millis() and micros() "C" style
// #define _TASK_EXTERNAL_TIME      // Custom millis() and micros() methods
// #define _TASK_THREAD_SAFE        // Enable additional checking for thread safety
// #define _TASK_SELF_DESTRUCT      // Enable tasks to "self-destruct" after disable

#include <TaskScheduler.h>



// ==== GLOBALS ===================================================================================
// ==== Scheduler ==============================
Scheduler ts;

void task1Callback();
void task2Callback();

// ==== Scheduling defines (cheat sheet) =====================
/*
  TASK_MILLISECOND  - one millisecond in millisecond/microseconds
  TASK_SECOND       - one second in millisecond/microseconds
  TASK_MINUTE       - one minute in millisecond/microseconds
  TASK_HOUR         - one hour in millisecond/microseconds
  TASK_IMMEDIATE    - schedule task to runn as soon as possible
  TASK_FOREVER      - run task indefinitely
  TASK_ONCE         - run task once
  TASK_NOTIMEOUT    - set timeout interval to No Timeout
  
  TASK_SCHEDULE     - schedule is a priority, with "catch up" (default)
  TASK_SCHEDULE_NC  - schedule is a priority, without "catch up"
  TASK_INTERVAL     - interval is a priority, without "catch up"
  
  TASK_SR_OK        - status request triggered with an OK code (all good)
  TASK_SR_ERROR     - status request triggered with an ERROR code
  TASK_SR_CANCEL    - status request was cancelled
  TASK_SR_ABORT     - status request was aborted
  TASK_SR_TIMEOUT   - status request timed out
*/

// ==== Task definitions ========================
Task t1 (100 * TASK_MILLISECOND, TASK_FOREVER, &task1Callback, &ts, true);
Task t2 (TASK_IMMEDIATE, 100 /* times */, &task2Callback, &ts, true);



// ==== CODE ======================================================================================

/**************************************************************************/
/*!
    @brief    Standard Arduino SETUP method - initialize sketch
    @param    none
    @returns  none
*/
/**************************************************************************/
void setup() {
  // put your setup code here, to run once:
#if defined(_DEBUG_) || defined(_TEST_)
  Serial.begin(115200);
  delay(2000);
  _PL("Scheduler Template: setup()");
#endif
}


/**************************************************************************/
/*!
    @brief    Standard Arduino LOOP method - using with TaskScheduler there 
              should be nothing here but ts.execute()
    @param    none
    @returns  none
*/
/**************************************************************************/
void loop() {
  ts.execute();
}


/**************************************************************************/
/*!
    @brief    Callback method of task1 - explain
    @param    none
    @returns  none
*/
/**************************************************************************/
void task1Callback() {
_PM("task1Callback()");
//  task code
}


/**************************************************************************/
/*!
    @brief    Callback method of task2 - explain
    @param    none
    @returns  none
*/
/**************************************************************************/
void task2Callback() {
_PM("task2Callback()");
//  task code
}





```

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 8047
Topic starter  

Trying again, used IDE 2.1.0 Copy and {;}

 

void setup(){ } void loop() { uint8_t pin = 2; int value = LOW; analogWrite(pin, value); }

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 8047
Topic starter  

Now trying <>

void setup(){
}

void loop() {
  uint8_t pin = 2;
  int value = LOW;

  analogWrite(pin, value);
}

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 8047
Topic starter  

Now Copy for forum markdown and {;}

 

```cpp void setup(){ } void loop() { uint8_t pin = 2; int value = LOW; analogWrite(pin, value); } ```

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 8047
Topic starter  

Now Copy for forum markdown and <>

```cpp
void setup(){
}

void loop() {
  uint8_t pin = 2;
  int value = LOW;

  analogWrite(pin, value);
}
```

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Page 1 / 2