Jump to content
Sign in to follow this  
mramos

How To Make An Equate In Boostbasic

Recommended Posts

I want to assign the value 2 to relay (const) as I have a relay on GPIO.2. Is there a wat to do equates so the code will look cleaner?

 

Is there a command for this? Also, is there a BoostBASIC ref language page I missed?

Share this post


Link to post
Share on other sites
I want to assign the value 2 to relay (const) as I have a relay on GPIO.2.  Is there a wat to do equates so the code will look cleaner?
Use:

#define Relay portb.0

or

 

dim Relay@PORTB.0 as bit

 

Notice the use of different case - its important.

 

Is there a command for this?  Also, is there a BoostBASIC ref language page I missed?

The only documentation that currently exists in the BoostBasic compiler help file.

 

Regards

Dave

Share this post


Link to post
Share on other sites
#define Relay portb.0

or

 

dim Relay@PORTB.0 as bit

 

Notice the use of different case - its important.

 

I type #define, but just put the bit value. That will work :(

 

The only documentation that currently exists in the BoostBasic compiler help file.

 

So I guess I can use the C manual and call the routines? The clear_bit did not work, but the set_bit did. but I had relay rather than a bit value in there I think. Will add the defines and see how it goes. Assume it will be call set_bit(relay) and the compiler will insert the two parameters.

 

EDIT:

 

I think I have it..

 

dim relay@GPIO.2 as bit

relay = 0 'clear it

relay = 1 'set it

Edited by mramos

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...