Ok how do code tags kinda' thing work in here?

They don't seem to behave the same here is in the old world.

-jim lee

Grave accent. One before and one after for inline. Three before and three after for block. For syntax highlighting put the language after the first three grave accents.

Rust

fn main() -> Result<(), Box<dyn std::error::Error>> {
  println!("This is sent to stdout.");
  Ok(())
}

C++

int main() {
  printf("This is sent to stdout.\n");
  return 0;
}

This might be helpful:

https://commonmark.org/help/

Lets see if I got this...


#include <mechButton.h>
#include <idlers.h>
//#include <AccelStepper.h>

#define BUTTON_PIN1  2     // Pin we'll hook the button to. The other side hooks to ground.
#define BUTTON_PIN2  3     // Pin we'll hook the button to.
#define motorInterfaceType 1

const int stepPin = 9; // Set the stepping pin to pin 9
const int dirPin = 8; // Set the direct pin to pin 8
int currentSpeed = 10; // Create a variable for speed
int btnOneState = 0; // Create a variable for reading button 1
int btnTwoState = 0; // Create a variable for reading button 2


mechButton button1(BUTTON_PIN1);  // Set button one to pin 2.
mechButton button2(BUTTON_PIN2);  // Set button one to pin 2.

AccelStepper myStepper(motorInterfaceType, stepPin, dirPin);

// Your standard sketch setup()
void setup() {
   
   button1.setCallback(myCallback1);    // Set up #1's callback.
   button2.setCallback(myCallback2);    // Set up #2's callback.
   myStepper.setMaxSpeed(1000);
   myStepper.setSpeed(currentSpeed);
}


// This is the guy that's called when the button1 changes state.
void myCallback1(void) {

   if (!button1.trueFalse()) {
      currentSpeed += 1;
      myStepper.setSpeed(currentSpeed);
   }
}


// This is the guy that's called when the button2 changes state.
void myCallback2(void) {

   if (!button1.trueFalse()) {
      currentSpeed -= 1;
      myStepper.setSpeed(currentSpeed);
   }
}


// Your standard sketch loop()
void loop() {
   
   bool  buttonState;
   
   idle();                                // Let all the idlers have time to do their thing.
   myStepper.runSpeed();
}

Hey thanks!

-jim lee

1 Like

I am glad it's not complicated :grinning:

Below is my result without naming a language, just the grave marks

1 Like

For that you are awarded the “Attaboy Badge”, congratulations !

image

Discourse does syntax highlighting based on automated language detection. Sometimes you might only want to post some text in a code block (e.g., build output) and find that it's doing some unwanted syntax highlighting. In this case you can specify the language as text to disable syntax highlighting.

For example, this markup:

```
leave it alone Discourse!
```

renders like this:

leave it alone Discourse!

but this markup:

```text
leave it alone Discourse!
```

doesn't get the silly coloring:

leave it alone Discourse!
1 Like

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.