Sending characters
7 years

I've been reading on serial commands, and while what I want to do is simple, I'm battling to do it RR, but I'm probably doing it wrong??

In hyperterminal, I can send "R" to my module. However, in RR if I use something like; if ("MOUSE_CLICK_X) > 400, then it sends out RRRRRRRRRRRRRRRRRRRRRRRRRRRR

Is there no "ON CLICK" ? I don't want to change the value to stop the stream. I just want to be able to set up simple instances to read and write single characters through three serial ports.

A second item;
I don't see any difference between "MOUSE_CLICK_X" and "MOUSE_X"
If I use the condition;   if ("MOUSE_X) > 400
I can watch the variable MOUSE_X go over 400 and nothing happens unless I click the mouse. Is that correct?
Roland from South Africa  [99 posts] 7 years
OK, I realised I need to set up flags and use the if statement to disable further sends, after the send, if a flag has been set.

I deduce that there is a "MOUSE_CLICK" because the 'Variable Watch' screen jumps if you click the mouse, momentarily as it shows '1'. So you never get to see;
MOUSE_CLICK    0     , while you do get to see;
MOUSE_X            0
MOUSE_Y            0

Steven from United States  [1425 posts] 7 years

Yes, you need to introduce a flag to prevent things from transmitting constantly. If you look at the docs for the If_statement you will see the "Latch" checkbox for the If Statements which helps for those variables that do not automatically reset. That can use used to isolate when a single click happens. In the case of MOUSE_CLICK that is already auto-reset as you have found out. It will be 1 for only when the user first clicks and regardless of the button status will then become zero on the second loop iteration.


The MOUSE_CLICK_X should only change when a click is made. MOUSE_X will always change if the mouse moves.

On the receive, try to use a Set_Variable before the serial module as it may be that no new characters are present in the serial read which means the variable is not modified which appears like it is reading the same value.

Roland from South Africa  [99 posts] 7 years

Hi Steven

Please could you look at this simple program and edit it so that it sends out a single character out, on reception of a single character in. It must use the serial port though. Doing it through the PC keypad is easy.

I don't want to send out a character per loop, but PER input character.
One character # in, one character S out.

It feels like I'm jumping through hoops trying to perform a most basic function.

Help appreciated..........
Steven from United States  [1425 posts] 7 years
Nothing new here ... just for completeness I'm attaching the robofile I last sent to you so that others reading this post have something they can refer to.


This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index