Shop OBEX P1 Docs P2 Docs Learn Events
Variable problem — Parallax Forums

Variable problem

computer guycomputer guy Posts: 1,113
edited 2008-09-15 10:03 in Propeller 1
Hi there,


I have a long with a string in it "010001".

so

[b]long[/b] output_command := "0100001"




I need to have a if statement check to see if each part of the string is a 1 or a 0.

It is a string to start with because it is read from a txt file on an sd card.
My code reads each line of the txt file and then needs to turn the command "0100001" into something useful.

How would I do this?


Thank you smile.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Building Blocks To The Propeller Chip A web site designed to help people who are new to the propeller chip.

Guitar Hero controller using the prop (WIP) --> HERE

Post Edited (computer guy) : 9/4/2008 12:59:20 PM GMT

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-09-04 12:59
    What you've posted is not a valid Spin statement. You can't have a long with "0100001" in it.

    Have you looked at the Extended Full Duplex Serial object in the Object Exchange. This has
    routines that convert input strings into numeric values. It calls Full Duplex Serial, but could
    be modified to call the SD card routines instead. In any event, it will show you how to do
    numeric string to number conversions. It has a decimal conversion routine, but I don't think
    it has a binary number conversion routine. It's just a simple matter of changing a value of 10
    to a value of 2 to handle binary numbers.

    Post Edited (Mike Green) : 9/4/2008 1:07:22 PM GMT
  • computer guycomputer guy Posts: 1,113
    edited 2008-09-04 13:02
    That was just a way of getting across what the variable is.

    CON
            _clkmode        = xtal1 + pll16x
            _xinfreq        = 6_000_000
    
            linelen         = 256
    obj
       term: "tv_text"
       sdfat: "fsrw"
       fmt: "format"
    var
       byte lbuf[noparse][[/noparse]linelen]
       long line
       long output_time
       long output_command
       word k
    pub go | x
       x := \start
       term.str(string("Returned from start", 13))
       term.dec(x)
       term.out(13)
    pub start | r, sta, bytes, l
       term.start(24)
       term.str(string("Mounting.", 13))        
       sdfat.mount(8)
       term.str(string("Mounted.", 13))
       sdfat.opendir
       r := sdfat.popen(string("abe.txt"), "r")
       term.str(string("Opening returned "))
       term.dec(r)
       term.out(13)
       repeat
          l := readline
          if l < 0
             quit
          split(line)
          'Code to go here
    pri readline | i, r
      i := 0
      repeat
          r := sdfat.pgetc
          if r == 13 or r == 10
              quit
          elseif r < 0
              return -1
          elseif i < linelen-1
              lbuf[noparse][[/noparse]i++] := r
      lbuf[i] := 0
      line := @lbuf
    
    pri split(t) | i
      k := fmt.bscanf(t,0,string("%s R"),@output_time)
      k := fmt.bscanf(t,k,string(" %s"),@output_command)
    
    PRI delay_ms(Duration)
      waitcnt(((clkfreq / 1_000 * Duration - 3932)) + cnt)
    
    [/i]
    




    That is the code I have.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Building Blocks To The Propeller Chip A web site designed to help people who are new to the propeller chip.

    Guitar Hero controller using the prop (WIP) --> HERE
  • Mike GreenMike Green Posts: 23,101
    edited 2008-09-04 13:11
    Look at the rxDec method in the Extended FDS object. It reads a line of text into a buffer, then validates it as a string of digits "0"-"9" with an optional leading sign "+" or "-", then converts the digit string to a number. It should be simple to change the 10s in the method to 2s, change the "9"s to "1"s, drop the sign check, and drop the initial reading of the text into the buffer since you have that already.
  • computer guycomputer guy Posts: 1,113
    edited 2008-09-04 13:15
    Will have a look at it in the morning.


    Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Building Blocks To The Propeller Chip A web site designed to help people who are new to the propeller chip.

    Guitar Hero controller using the prop (WIP) --> HERE
  • computer guycomputer guy Posts: 1,113
    edited 2008-09-05 06:23
    Hi Mike,


    Where exactly can I find the Extended FDS object? I have searched the forums, web and obex however cannot find it anywhere.


    Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Building Blocks To The Propeller Chip A web site designed to help people who are new to the propeller chip.

    Guitar Hero controller using the prop (WIP) --> HERE
  • computer guycomputer guy Posts: 1,113
    edited 2008-09-07 03:32
    Does anyone know where I can find it?


    Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Building Blocks To The Propeller Chip A web site designed to help people who are new to the propeller chip.

    Guitar Hero controller using the prop (WIP) --> HERE
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2008-09-07 03:37
    Is this what you are looking for?

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Getting started with a Propeller Protoboard?
    Check out: Introduction to the Proboard & Propeller Cookbook 1.4
    Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
    Got an SD card connected? - PropDOS
  • Mike GreenMike Green Posts: 23,101
    edited 2008-09-07 03:38
    It's in the Object Exchange under "Extended Full Duplex Serial".

    Here's the link: obex.parallax.com/objects/31/
  • computer guycomputer guy Posts: 1,113
    edited 2008-09-07 03:53
    Thank you. I didnt know what FDS was. I feel really dumb now.


    Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Building Blocks To The Propeller Chip A web site designed to help people who are new to the propeller chip.

    Guitar Hero controller using the prop (WIP) --> HERE
  • computer guycomputer guy Posts: 1,113
    edited 2008-09-07 05:29
    I have this code:

    CON
            _clkmode        = xtal1 + pll16x
            _xinfreq        = 6_000_000
    
            linelen         = 256
    obj
       term: "tv_text"
       sdfat: "fsrw"
       fmt: "format"
    var
       byte lbuf[noparse][[/noparse]linelen]
       long line
       long output_time
       long output_command
       word k
    pub go | x
       x := \start
       term.str(string("Returned from start", 13))
       term.dec(x)
       term.out(13)
    pub start | r, sta, bytes, l
       term.start(24)
       term.str(string("Mounting.", 13))        
       sdfat.mount(8)
       term.str(string("Mounted.", 13))
       sdfat.opendir
       r := sdfat.popen(string("abe.txt"), "r")
       term.str(string("Opening returned "))
       term.dec(r)
       term.out(13)
       repeat
          l := readline
          if l < 0
             quit
          split(line)
          output_time := toDec(@output_time)
          term.str(string("Dec: ", 13))
          term.dec(@output_time)
          term.out(13)
          'Code to go here
    pri readline | i, r
      i := 0
      repeat
          r := sdfat.pgetc
          if r == 13 or r == 10
              quit
          elseif r < 0
              return -1
          elseif i < linelen-1
              lbuf[noparse][[/noparse]i++] := r
      lbuf[i] := 0
      line := @lbuf
    
    pri split(t) | i
      k := fmt.bscanf(t,0,string("%s R"),@output_time)
      k := fmt.bscanf(t,k,string(" %s"),@output_command)
    
    PRI delay_ms(Duration)
      waitcnt(((clkfreq / 1_000 * Duration - 3932)) + cnt)
    
    pri toDec(data) : Value | place, ptr, x
    {{
       Accepts and returns serial decimal values, such as "1234" as a number.
       String must end in a carriage return (ASCII 13)
       x:= Serial.rxDec     ' accept string of digits for value
    }}   
        place := 1
        value := 0                               
        if (data[noparse][[/noparse]0] => ("0")) and (data[noparse][[/noparse]0] =< ("9")) 
          value := value + (data[noparse][[/noparse]0]-48) * place
        elseif data[noparse][[/noparse]0] == "-"                                  
             value := value * -1
        elseif data[noparse][[/noparse]0] == "+"                               
             value := value
    [/i]
    



    This input:

    32736327 R 100001
    36828367 R 100001
    38874388 R 100001
    45012449 R 100001
    49104490 R 010001
    
    




    But have this output:

    Dec:
    6272
    Dec:
    6272
    Dec:
    6272
    Dec:
    6272
    Dec:
    6272
    Dec:
    6272
    
    





    Can someone please take a quick look at my code and see what needs to be done to get this to work.
    I need both output_time and output_command as a number but am just trying to get output_time to work at the moment.
    The other should be easy.


    Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Building Blocks To The Propeller Chip A web site designed to help people who are new to the propeller chip.

    Guitar Hero controller using the prop (WIP) --> HERE
  • StefanL38StefanL38 Posts: 2,292
    edited 2008-09-07 11:07
    Hello computerguy,

    if i take a QUICK look at your code i can't find the place where the conversion is done

    taking a middlelong look at it i see that the method todec still looks for DECIMAL values instead for BINARY values

    could you please comment almost each line what you INTEND to do

    to me it seems like you have still lack of understanding what longs and pointers to strings are and how to use pointers and strings

    f.e. the variable output_time is defined as a long
    this means it can contain FOUR bytes (=32bits)

    I don't know the fomat functions in detail but one thing is for sure:
    there has to place reserved in memory to store the strings in it

    if the command fmt.bscanf(t,0,string("%s R"),@output_time)
    should store the string at adress of output_time and the string is longer than 4 bytes
    it will override the content of the following long output_command !!

    inside a string every character needs a byte=8bits. A string of 10 characters needs 10 bytes of memory and you have to reserve it

    so i guess one thing to is to define bytearrays where the characters of the strings find place to be stored

    the other thing is to change the method ToDec to a NEW method ToBinary
    take a look at wikipedia how binary numbers work and then you can program the method yourself

    best regards

    Stefan
  • computer guycomputer guy Posts: 1,113
    edited 2008-09-07 11:36
    fmt.bscanf(t,0,string("%s R"),@output_time) only accepts a long as the output.

    Changing
       long output_time
       long output_command
    
    



    TO

       long output_time[noparse][[/noparse]linelen]
       long output_command[noparse][[/noparse]linelen]
    
    



    Has solved the problem of the time and command becoming over written.
    However I am sure this uses up excess memory.

    This is the function.
    PUB bscanf(str,si,fmt,arg): index | width,bi,sign,p,skip,sorg
      '/**
      ' * Scan formatted string into variable, maintaining formatted string index
      ' * (special version of sscanf, to ease porting scanf and sscanf with multiple arguments)
      ' * format specifiers for byte, word, long: %c,%d,%i,%b,%o,%u,%x
      ' * format specifier for string: %s
      ' * field specification (example)
      ' *   %*4d where * specifies to scan but not assign scanned value
      ' *              4 (maximum) field width to scan
      ' *
      ' * Example:
      ' * An original C sscanf statement like
      ' * sscanf(buffer,"outside temperature %d %s inside temperature %d %s",&outtemp,outunit,&intemp,inunit);
      ' * would be written as:
      ' * OBJ
      ' *   fmt: "Format"
      ' * VAR
      ' *   byte buffer[noparse][[/noparse]128] 'holds string to scan
      ' *   byte outunit[noparse][[/noparse]16] 'to hold celsius/fahrenheit
      ' *   byte inunit[noparse][[/noparse]16]  'to hold celsius/fahrenheit
      ' *   long outtemp
      ' *   long intemp
      ' *   word k
      ' * PUB
      ' *   k := fmt.bscanf(@buffer,0,string("outside temperature %d "),@outtemp)
      ' *   k := fmt.bscanf(@buffer,k,string("%s "),@outunit)
      ' *   k := fmt.bscanf(@buffer,k,string("inside temperature %d "),@intemp)
      ' *   k := fmt.bscanf(@buffer,k,string("%s"),@inunit)
      ' *
      ' * The original sscanf is simply split up in smaller bscanf statements that take only 1 argument.
      ' * The variable k keeps track of the parsing position.
      ' *
      ' * @param str Character array holding formatted string to be scanned
      ' * @param si Start index in str to read from
      ' * @param fmt String defining format
      ' * @param arg address of variable to hold scanned value
      ' * @return Index in str pointing at next position to read
      ' */
      sorg := str
      str += si
      repeat while byte[noparse][[/noparse]fmt] <> 0
        if isspace(byte[noparse][[/noparse]fmt])                    '// white space in format
          repeat while isspace(byte[noparse][[/noparse]str])
            ++str           '// skip white space in str
          if byte[noparse][[/noparse]str] == 0
            return 0
          ++fmt
          next
        if byte[noparse][[/noparse]fmt] <> "%"            '// non-white space in format but no %
          repeat while isspace(byte[noparse][[/noparse]str])
            ++str           '// skip white space in str
          if byte[noparse][[/noparse]str] == 0
            return 0
          if byte[noparse][[/noparse]str] <> byte[noparse][[/noparse]fmt]
            return str-sorg      '// no match in str
          ++str
          ++fmt
          next
        ++fmt                                      '// skip over %
        if byte[noparse][[/noparse]fmt] == "*"
          skip := true
          ++fmt
        else
          skip := false
        if isdigit(byte[noparse][[/noparse]fmt])                     '// field width
          bi := 0
          repeat while isdigit(byte[noparse][[/noparse]fmt])
            buf[noparse][[/noparse]bi++] := byte[noparse][[/noparse]fmt++]
          buf[noparse][[/noparse]bi] := 0
          width := atoi(@buf)
        else
          width := 32767
        repeat while isspace(byte[noparse][[/noparse]str])
          ++str
        if byte[noparse][[/noparse]str] == 0
          return 0
        case byte[noparse][[/noparse]fmt]
          "c": if !skip
                 byte[noparse][[/noparse]arg] := byte[noparse][[/noparse]str]
               ++str
          "s": bi := 0
               repeat while (width > 0) AND !isspace(byte[noparse][[/noparse]str])
                 width--
                 if !skip
                   byte[noparse][[/noparse]arg++] := byte[noparse][[/noparse]str]
                 ++str
               if !skip
                 byte[noparse][[/noparse]arg] := 0            '// closing 0
               if byte[noparse][[/noparse]str] == 0
                 return 0
          other: if byte[noparse][[/noparse]str] == "-"
                   sign := -1
                   ++str
                 else
                   if byte[noparse][[/noparse]str] == "+"
                     sign := 1
                     ++str
                   else
                     sign := 1
                 if isxdigit(byte[noparse][[/noparse]str])              '// integer value
                   bi := 0
                   repeat while (width > 0) AND isxdigit(byte[noparse][[/noparse]str])
                     width--
                     buf[noparse][[/noparse]bi++] := byte[noparse][[/noparse]str++]
                   buf[noparse][[/noparse]bi] := 0
                   case byte[noparse][[/noparse]fmt]
                     "d","i": p := sign * atoi(@buf)
                     "b": p := atoib(@buf, 2)
                     "o": p := atoib(@buf, 8)
                     "u": p := atoib(@buf, 10)
                     "x": p := atoib(@buf, 16)
                     "f": 'not supported yet        '//32bit floating point
                          skip := true
                          p := 0
                     other: skip := true
                            p := 0
                   if !skip
                     LONG[noparse][[/noparse]arg] := p
        ++fmt
      return str-sorg
    
    




    I have no idea how todec works as its not my code and not commented at all.


    Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Building Blocks To The Propeller Chip A web site designed to help people who are new to the propeller chip.

    Guitar Hero controller using the prop (WIP) --> HERE
  • computer guycomputer guy Posts: 1,113
    edited 2008-09-07 13:12
    All I need to do now is convert "32736327" (as a long array) to 32736327.

    Any ideas?


    Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Building Blocks To The Propeller Chip A web site designed to help people who are new to the propeller chip.

    Guitar Hero controller using the prop (WIP) --> HERE
  • Mike GreenMike Green Posts: 23,101
    edited 2008-09-07 15:04
    Call this routine with the address of "32736327" as the parameter
    and it will return the value 32736327. The string has to be terminated
    with some non-digit byte (like the normal zero byte that ends a string).
    If the string starts with a non-digit byte, the value zero will be returned.
    PRI convertToDec(stringAddress) | temp
      temp := byte[noparse][[/noparse]stringAddress]
      repeat while temp => "0" and temp =< "9"
        result := result * 10 + (temp - "0")
        temp := byte[noparse][[/noparse]++stringAddress]
    
  • computer guycomputer guy Posts: 1,113
    edited 2008-09-07 22:07
    Thanks Mike.

    It still only returns a weird number like 6284.
    I will upload my code (commented) when I get home this afternoon.


    Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Building Blocks To The Propeller Chip A web site designed to help people who are new to the propeller chip.

    Guitar Hero controller using the prop (WIP) --> HERE
  • Mike GreenMike Green Posts: 23,101
    edited 2008-09-07 22:41
    I just noticed you had "term.dec(@output_time)" for some reason in your program.
    This will display the address of output_time, not the value of it. You want:
    "term.dec(output_time)"
  • computer guycomputer guy Posts: 1,113
    edited 2008-09-08 05:49
    Thank you Mike.

    Now I just need to work out how to analyse each individual value of the number.

    I am still learning about bytes, arrays and such.

    I would have thought that output_command[noparse][[/noparse] 0] would have given me the first number in output_command and output_command[noparse][[/noparse] 1] would have given me the second.
    But it still gives me the entire number.

    Also how do I stop the decimal conversion code from truncating the 0's at the start of output_command.

    Basically
    100001
    
    



    means that buttons 1 and 6 are pressed.
    But the conversion code gets
    000001
    
    



    and returns
    1
    
    




    Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Building Blocks To The Propeller Chip A web site designed to help people who are new to the propeller chip.

    Guitar Hero controller using the prop (WIP) --> HERE
  • computer guycomputer guy Posts: 1,113
    edited 2008-09-09 07:00
    Anyone have any thoughts?

    Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Building Blocks To The Propeller Chip A web site designed to help people who are new to the propeller chip.

    Guitar Hero controller using the prop (WIP) --> HERE
  • StefanL38StefanL38 Posts: 2,292
    edited 2008-09-09 15:11
    hello computerguy,

    oh i have a lot thoughts

    first is "the members of the forum are willing to help. But there has to come something more from you."

    second is "i would like to aks you if you had understand the following line of code"

    [noparse][[/noparse]code]

    result := result * 10 + (temp - "0")

    [noparse][[/noparse]\code]

    do you UNDERSTAND what happens here ?

    simple answer "yes" or "no"

    complete answer: description in your own words what it does

    another problem I have:

    it is very hard to imagine what you have CODED without seeing your code

    nothing is clear

    did you use the method that Mike posted above ?

    did you use the "old" ToDec-method from your program more above?

    everything gets clear if you add comments to your code in that lines where you think the problem isl
    an then
    please, please, please, please post your COMPLETE code as an attachment
    another way could be a test-program just containing the interesting part but still as a COMPLETE program
    NO CODE-SNIPPETS !

    and if you add an example of what you "put in" and what "comes out" it will become much easier to analyse the whole thing

    did you try to debug your code by sending the values of every variable engaged in the conversion to a terminalsoftware like PST.EXE ?

    another thing ASCII-code characters have values between 0 and 255 these values fit in one BYTE
    define output_time output_comman

    as BYTE-arrays NOT as LONG-arrays

    best regards

    Stefan
  • computer guycomputer guy Posts: 1,113
    edited 2008-09-10 06:49
    Hi Stefan,

    No I dont understand the line
    result := result * 10 + (temp - "0")
    
    



    I used the code that Mike posted above.

    I will finish commenting my code and upload it.

    The values are read from an SD card. The output is displayed using the TV text driver.

    output_time and output_command have to be a long array as the code that splits the string will only accept a long array.


    Thank you for your help. smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Building Blocks To The Propeller Chip A web site designed to help people who are new to the propeller chip.

    Guitar Hero controller using the prop (WIP) --> HERE
  • StefanL38StefanL38 Posts: 2,292
    edited 2008-09-10 19:37
    Hello Computerguy,

    this line above is from the code that mike posted and that you are using.

    i think the array should be a byte-array because
    the PUB bscanf(str,si,fmt,arg): index | width,bi,sign,p,skip,sorg

    uses commands "byte[noparse][[/noparse]str]" all the time

    parameters have to be longs and the parameter "str" of PUB bscanf has to be a long too
    But parameter "str" is the POINTER to the BYTE-Array containing the string and NOT the array itself

    if the string is "ABC" which is in ASCII-code A=65, B=66, C=67
    the byte-array contains

    first byte 65
    second byte 66
    third byte 67

    the POINTER contains the ADRESS WHERE the values 65 66 67 are stored

    Let's say the base-adress of the string-pointer str is 1000

    if you increment the value of str by one and use it with byte[noparse][[/noparse]str] you are accessing
    RAM-Byte 1001

    if you use it with long[noparse][[/noparse]str] you access RAM-Byte 1005

    or other way round if you have stored the characters of your string in a LONG-array

    Let's say the string is "ABC" which is in ASCII-code A=65, B=66, C=67
    the RAM-bytes contain the following
    byte 1000: 65
    byte 1001: 0
    byte 1002: 0
    byte 1003: 0
    byte 1004: 66
    byte 1005: 0
    byte 1006: 0
    byte 1007: 0
    byte 1008: 67
    byte 1009: 0
    byte 1010: 0
    byte 1011: 0

    now the PUB bscanf(str,si,fmt,arg): index | width,bi,sign,p,skip,sorg
    accesses the string by byte[noparse][[/noparse]str]
    with the first character this is working

    then str which contains value 1000 is incremented by one
    new value 1001
    byte[noparse][[/noparse]str]=byte[noparse][[/noparse]1001] gets back value 0 INSTEAD of 66 wich ist stored in byte 1004

    I hope you can see that you have to take care of the variabletypes very much if your code uses POINTERS.

    And this is a very good example why it makes sense to understand the code in medium detail-deph

    Using code with NO understanding at all leaves you in the position of COMPLETE dependence of others
    As soon as a strange problem occurs you have to ask an expert about this.

    Again my question: do you know how to use FullDuplexSerial to send debug-information to the PC ?
    yes or no

    best regards

    Stefan
  • computer guycomputer guy Posts: 1,113
    edited 2008-09-11 06:09
    Thank you Stefan. smile.gif

    Yes I do know how to use FullDuplexSerial to send information to a PC terminal.
    I have a tv connected and would prefer to use that for debug.


    Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Building Blocks To The Propeller Chip A web site designed to help people who are new to the propeller chip.

    Guitar Hero controller using the prop (WIP) --> HERE
  • computer guycomputer guy Posts: 1,113
    edited 2008-09-11 10:12
    Here is my code. I have commented it as much as possible.


    Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Building Blocks To The Propeller Chip A web site designed to help people who are new to the propeller chip.

    Guitar Hero controller using the prop (WIP) --> HERE
  • computer guycomputer guy Posts: 1,113
    edited 2008-09-14 05:19
    I don't mean to rush anyone but could someone please take a look at the few things I need help with please.

    1. Getting output_time and output_command to be byte arrays.
    2. Getting output_command to have prefixed 0's.
    3. An if statement to check if each numeral in output_command is a 1 or a 0.


    Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Building Blocks To The Propeller Chip A web site designed to help people who are new to the propeller chip.

    Guitar Hero controller using the prop (WIP) --> HERE
  • computer guycomputer guy Posts: 1,113
    edited 2008-09-14 22:25
    Here is the latest code.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Building Blocks To The Propeller Chip A web site designed to help people who are new to the propeller chip.

    Guitar Hero controller using the prop (WIP) --> HERE
  • computer guycomputer guy Posts: 1,113
    edited 2008-09-15 10:03
    Updated code.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Building Blocks To The Propeller Chip A web site designed to help people who are new to the propeller chip.

    Guitar Hero controller using the prop (WIP) --> HERE
Sign In or Register to comment.