Building A String
Lightfoot
Posts: 228
With spin, how do you build a string with the two variables name and IDNum in the specified locations in the string?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Pseudocode: name := string("Gordon Lightfoot") IDNum := 6453789 SER.str(string("His name is " <name> ". The ID number is " <id>)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Comments
SER.str( string("His name is ") )
SER.str(@name)
SER.str( string(". The ID number is ") )
SER.dec( IDNum )
or
SER.hex( IDNum, 8 )
or
SER.bin( IDNum, 32 )
What i want to do is send the string and compare it to another string in the receiver method for equality.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
SER.dec( IDNum )
SER.tx( $0d )
would for example a carriage return to the string which can be used as end-character.
The serial interface is buffering the characters. So, the receiver won't notice that you used several calls instead of one because it's very unlikely that the buffer runs out of character before the next call of a SER.* function in your case.
N_E_T_I_D_<network ID>_A_N_I_I_D_<Receiver ID>
Transmit Code:
Receive Code:
When the input string (read in the variable buffer) matched the animatorIDString, the loop should break. It does not. The problem is probably simple, but I have never dealt with sending strings serially over XBEE. The receiver uses the extended full duplex serial for receiving the string. What is up here?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dave
This is my new transmitter code:
This is is the new receiver code.
This code should work, but it does not. I tried messing around with the delimiter characters to no avail. What is missing?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔