Silly question: how to post code here?

WhiteSpace

Well-known member
Apologies for the really silly question: how do I post code here so that it looks like this:

23263

If I copy it in PE6 using the "copy for forum" command, and paste it here, it looks nothing like this. I'm obviously missing something vital.

Thanks very much.
 

lbenson

Senior Member
I do it the old fashioned way, from before the purportedly simplifying "copy for forum" option made it, to my mind, more complicated. If you type the forum tags, "[ code]" and "[ /code]" (but omit the spaces I've put in after "["), and then paste in your code between them, it works.
Code:
'08Test4.bas ' gets inputs for 20htmlserver
#picaxe 08m2
#terminal 19200 'turn on terminal after program load--16mHz
'#no_data
'#no_table

symbol pTCPin=4 ' b.6 receive http/TCP
symbol cBaudrate=T19200_16

setfreq m16

pause 16000
sertxd("08Test4",cr,lf)

main:
  do
    serin [64000,skip], pTCPin, cBaudrate, b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11 ' 8 sec@32mHz
    sertxd(b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11," ")
  skip:
    pause 2000
  loop
No apologies necessary. Welcome to the forum.
 

inglewoodpete

Senior Member
Not such a silly question! Until the feature is updated in PE6 for the new forum software, do the following:
  1. In PE6, highlight the code you want to post.
  2. Click "Copy for Forum" in PE6.
  3. Paste the contents of the clipboard in your forum page editor.
  4. At the top of your code block, you should find the CODE tag. Manually edit [code] to [code=rich]
  5. Have a look at your efforts by clicking on the preview button.
Example:
Rich (BB code):
Symbol oLCDpin7   = outpinB.7 '28 S.7 B.7  for writing to the output pin directly
Symbol oLCD7      = S.7       '28 B.7 S.7
Symbol oLCDRS     = S.8       '11 C.0
Symbol oLCDEn     = S.9       '12 C.1 S.9  (pwmC.1)
Symbol oLCDBkLite = S.10      '13 C.2 S.10 (pwmC.2) - Used to control backlight brightness
'Symbol           = S.11      '16 C.5      hspi sdo
'Symbol           = S.12      '15 C.4      hspi sdi / hi2c sda
Symbol oLED       = S.13      '14 C.3      hspi sck / hi2c scl
'
' **** Registers ****
'
' Keystroke validation/usage status bits
Symbol tKeyResolved  = bit1   'Keypress has been resolved and Key number (1 to 26) identified
Symbol tKeyTimeOut   = bit2   'Key has been held and timer has expired
Symbol tKeyDown      = bit4   'Key identified was still held at last read
'
' Timer status/control bits
Symbol tOnTimeChgd   = bit1   'Used during configuration of On and Off times
Symbol tOffTimeChgd  = bit2   'Used during configuration of On and Off times
Symbol tTickFlag     = bit3   'Indicates when time is to be rewritten to screen
 

eclectic

Moderator
And an oldy but goody


e
 

techElder

Well-known member
All that purty "Copy for Forum" code will quickly run into this forum's max characters post limit, because of all of the HTML characters that you don't see.

The forum limits make that PE6 function useless for anything more than snippets of code.
 

WhiteSpace

Well-known member
Thanks all for the suggestions. I looked at the "Read Me First" thread first, of course, and thought I was following the instruction there, but was clearly doing something wrong because I ended up with huge numbers of extra characters appearing. Anyway, I've now cracked it, and posted a post with some snippets of code.
 

techElder

Well-known member
ended up with huge numbers of extra characters appearing
FYI, at the bottom of every forum page there is an item called "Help" that takes you to a page where BBCODE is explained in detail. One of those items is for the [CODE] item where [CODE=rich] {paste your program items from PE} [/CODE] is necessary to properly show the color version of "Copy for Forum" code.
 

tmfkam

Senior Member
Easier still perhaps?

Along the top of the area that you type your "post" text into, there is a toolbar. On the toolbar I see (in case it is different for others) there is a button immediately to the right of the smiley with three dots and an arrow. Tap on that and you get an option for "</> Code". Tap that, enter your code in the entry box that appears, hey presto! Code is inserted. What does the inline code option do? Puts your code into the current line of text, in a neat little font, without using the entry box and (presumably) without indentation.
 

techElder

Well-known member
Even easier ... in the entry box pop-up choose "Language" "Rich (BB code)" before you paste in the color version of "Copy for Forum" code.

Rich (BB code):
This is rich!
 
Top