Notifications
Clear all

Hello from Reno NV.

56 Posts
7 Users
5 Likes
630 Views
olddude
(@olddude)
Eminent Member
Joined: 5 months ago
Posts: 26
Topic starter  

@will I get this message during an attempt to compile my sketch?  I can't find a reference to it anywhere.  


   
ReplyQuote
Will
 Will
(@will)
Famed Member
Joined: 2 years ago
Posts: 2235
 

@olddude 

Seriously ?

Think how we're supposed to explain a compile time error that you get compiling your sketch when you don't show us either the error message nor the code.

Experience is what you get when you don't get what you want.


   
Ron reacted
ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 4015
 

@will @olddude See Help for instructions how to post code and post a picture of the error

 

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


   
ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 4015
 

@olddude Also, it would help if we knew what your invention is, pictures, some sort of description?

 

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


   
ReplyQuote
olddude
(@olddude)
Eminent Member
Joined: 5 months ago
Posts: 26
Topic starter  

@will  Here is my first attempt to write a sketch.

void setup() {
const int STEPS_PER_REV = 200;
const int SPEED_CO
Stepper stepper_NEMA17(STEPS_PER_REV), 8,9,10,11);

}
void loop() {

stepper_NEMA17SetSpeed. setSpeed(motorSpeed);
stepper_NEMA17. step(STEPS_PER_REV / 100);
Delay Microseconds (1000);
]
]

 

This is the response from Arduino

void setup() {
const int STEPS_PER_REV = 200;
const int SPEED_CO
Stepper stepper_NEMA17(STEPS_PER_REV), 8,9,10,11); This line is highlighted (error msg below)

}
void loop() {

stepper_NEMA17SetSpeed. setSpeed(motorSpeed);
stepper_NEMA17. step(STEPS_PER_REV / 100);
delayMicroseconds(1000);
]
]

 

(expected initializer before 'stepper'


   
ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 4015
 

@olddude Please read HELP on how to post code and post a picture of the error you get with a screen grab (Mac Shift Cmd 4, Win ?????)

 

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


   
ReplyQuote
olddude
(@olddude)
Eminent Member
Joined: 5 months ago
Posts: 26
Topic starter  

@zander 

will do


   
ReplyQuote
Inq
 Inq
(@inq)
Noble Member
Joined: 10 months ago
Posts: 982
 

This should work better, but the SPEED_CO statement needs finishing.  And see other comments in code.

// These are called global variables and constants.  
// They need to be seen by all parts of your code.

const int STEPS_PER_REV = 200;
const int SPEED_CO                               //  <= This is not a statement.
Stepper stepper_NEMA17(STEPS_PER_REV), 8,9,10,11);

void setup() 
{
}

void loop() 
{
  stepper_NEMA17SetSpeed. setSpeed(motorSpeed);
  stepper_NEMA17. step(STEPS_PER_REV / 100);
  // This is not a valid statement... Delay Microseconds (1000);
    delay(1000);   // This is.
// ]  This is not valid here... stray character.
// ]
// You had no curely brace to end
}
 

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, Access Point Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


   
ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 4015
 

@olddude Should look like this

Screen Shot 2022 09 25 at 12.38.18
void setup() {
const int STEPS_PER_REV = 200;
const int SPEED_CO
Stepper stepper_NEMA17(STEPS_PER_REV), 8,9,10,11);

}
void loop() {

stepper_NEMA17SetSpeed. setSpeed(motorSpeed);
stepper_NEMA17. step(STEPS_PER_REV / 100);
Delay Microseconds (1000);
]
]

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


   
ReplyQuote
Will
 Will
(@will)
Famed Member
Joined: 2 years ago
Posts: 2235
 

@olddude 

This version compiles clean, it doesn't do anything and I guessed at your speed declaration

 

 

#include <Stepper.h>

 const int STEPS_PER_REV = 200;
 const int SPEED_CO = 1;
 
Stepper stepper_NEMA17(STEPS_PER_REV, 8, 9, 10, 11);

void setup() {
    stepper_NEMA17.setSpeed(SPEED_CO);
}

void loop() {
    stepper_NEMA17.step(STEPS_PER_REV / 100);
    delayMicroseconds(1000);
}

 

 

Experience is what you get when you don't get what you want.


   
ReplyQuote
olddude
(@olddude)
Eminent Member
Joined: 5 months ago
Posts: 26
Topic starter  

@will I can't thank you enough.  


   
ReplyQuote
Page 4 / 4