loading
 
Serial
YeOh from Malaysia  [2 posts]
6 years
Hello, I have several questions about Roborealm and Serial Communication.The microcontroller I'm using is Atmega8

1. How do we use the Serial function in the roborealm? For example how do we choose 'left_servo' to move and 'right_servo' ONLY when it detects something like a ball. In the Serial function, I don't get to choose which variable to control, it only has weird sequence that I can send like IMAGE_COUNT and other things I don't understand.is it possible to choose a variable like  'left_servo' to control? if possible, how? (The variable'left_servo' is installed in the microcontroller)

2. Is it possible to have an 'if-statement' in the serial function? For example, do this only IF you see something.

3. Is it possible to let it keep on sending info until I tells it to stop?

Basically all I want to do is that is to use roborealm to process image and according to the processed image(like detecting something) do something. And also how exactly do we use the serial function to control the servos on the robot turning. It does not have the variables that I had installed on the microcontroller, so I can't control what to do.
Anonymous 6 years
YeOH,

The serial module does not have the ability that you are expecting. It is a module used to send data ... any data ... across a communication line. This means it has NO knowledge of what is on the other end nor what variables you have declared or use in your MCU.

The usage of this module is about sending a stream of data to your device which YOU are then responsible for parsing and extracting out the various bits and bytes into meaningful variables. For example,

128,1,255

could be a stream that it sends. What are these numbers? You will not know unless I tell you what I intended to send out over the connection. That the same issue your mcu will have. If you then see

[COG_Y],[IR_FLAG],[COG_X]<cr>

suddenly the stream makes more sense to you but you still need to have your MCU parse the 3 numbers and save them into appropriate variables.

In the Atmel you will need to read in serial chars (using something like Serial.read()) and read in the digits and stop when you see a ',' or a newline, save that data and continue reading. Its a program YOU have to write on your MCU.

1.

[servo_string]

in the serial module with

if GetVariable("COG_BOX_SIZE")>10 then

  SetVariable "servo_string", GetVariable("left_servo") & "," & GetVariable("right_servo")

else

  SetVariable "servo_string", ""

end if

in a VBScript program module will send the motor variables over serial only if something is detected (assuming COG used here).

2. No ifs in the serial module. Just conditionally modify a variable as seen above.

3. Yes, again, just zero the variable when you want to stop sending.

STeven.

YeOh from Malaysia  [2 posts] 6 years
Are there other ways to send signals to the microcontroller?
Anonymous 6 years
Depends on the MCU. Normally serial is used but ethernet packets are also used.

If you instead mean are there any other modules that talk with MCUs then have a  look at the MCU controller module. Its really for advanced users though as you have to understand the code on the MCU in order to extend that.

http://www.roborealm.com/help/MCU_Communicator.php

If that isn't helpful check the forum for other integration with the BS2 (basic stamp) and propeller which may provide more info.

STeven.

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