Ultrasonic Distance icon Ultrasonic Distance — Displays HC-SR04 ultrasonic distance readings in ARC; scriptable via GetPing(), pausable, sets a variable with multiplier, optional NMS output Try it →
Asked — Edited
Resolved Resolved by Steve1DH!
V4 Two Way Serial Communication - Where Do I Connect To Read?

V4 Two Way Serial Communication - Where Do I Connect To Read?

Hi all,

I'm trying to get serial feedback from a device. Does anyone know where on the V4 I should attach to read back serial information from device? I know I send a serial command to through one of V4's digital signal pins but where do I read it back from?

I thought it would be read from the same digital pin I sent the command. However @Toymaker made a comment in another thread that it may have to be read through one of the i2c ports.

Any insight is welcomed. :)


ARC Pro

Upgrade to ARC Pro

Stay at the forefront of robot programming innovation with ARC Pro, ensuring your robot is always equipped with the latest advancements.

Author Avatar
United Kingdom
LinkedIn Twitter Google+ YouTube
#17  

Here's a huge secret, DJ's method above is how I manage to look like I know what I'm doing 99% of the time!:D

#18  

Rich you're too modest... I would say more like 99.9%;)

#19  

@ Dave - Thank You for the credit.

#20  

:P @DJ, your a scream!; "calmly following these steps". "Calmly" is my middle name. ;)

Your right though. I could have probably found the answer to this question if I had just slowed down and re-read the spec sheet. I do get in a hurry at times. It usually results in a flash and smoke. eek

Also this is not for displays. I'm trying to set up a two way serial connection between EZB V4 and a Kangaroo / Sabertooth. I need the Roo to tell me where it is after I send a serial command to move to a set position.

Author Avatar
PRO
Synthiam
LinkedIn Thingiverse Twitter YouTube GitHub
#21  

Lol you indeed are one of the most patient people I've ever met. I write for the masses, knowing that future readers will stumble across my posts. Never think I'm directing anything at any specific someone. It's always generic.

Much like how I explain where the learn button is. Of course you all know. But someone new may not know... So I be specific for the future:)

Author Avatar
PRO
United Kingdom
LinkedIn Twitter Google+ YouTube
#22  

Dave, I referred to I2C port as I am still using a V3 so my PIC does the conversion from I2C to bi-directional comms to the serial port of the Kangaroo, hope this helps.

#23  

@Tony, each time you post it always a huge help. Thanks, the confusion was my fault not yours. When I thought it through I came to that conclusion.

#24  

Ok... I can't find any example using uart method, neither in local examples nor in the cloud... is it me or they all disappeared?

Some basic quesitons :

I'm trying to TX buffer values (between 0 and 640) from an arduino (running a code to read motors' encoders) to EZB UART0. I hooked arduino's tx to EZB's rx and arduino's rx to tx (although I only need to receive data from arduino, but in the doubt... not sure if they both need to be connected).

I tried these codes so far, without success :


UARTInit( 1, 0, 9600 )

$available = UARTAvailable( 1, 0 )

print($available)

UARTRead(0, 0,$available)

UARTReadBinary(0, 0, $available, $variab)

print($variab)

sleep(200)

halt() 

here is what I get :


Start
1: UARTInit( 1, 0, 9600 )
3: $available = UARTAvailable( 1, 0 )
5: print($available)
> 0
7: UARTRead(0, 0,$available)
9: UARTReadBinary(0, 0, $available, $variab)
11: print($variab)
> Error on line 11: Variable is an array: $variab
Done (00:00:00.1605282)

FYI if you type what the Script Help says about UartReadBinary() you get an error message :


UARTReadBinary(0, 0, UARTAvailable(0, 1), $variable)

here is what it returns :


16: UARTReadBinary(1, 0, UARTAvailable(0, 1), $variable)
> Error on line 16: Missing ) in Expression
Done (00:00:00.4367821)

that's why I used a variable for the UartAvailable() function, above. 

I'm desperately trying to get data returned. It works in the terminal EZB, I receive the counts from the encoders connected to the arduino. So, here is my real question (and since I couldn't find any example using UART keyword in the examples despite what was said earlier in this thread) :

How do I get to read what comes from this arduino the same way they are read and displayed in the serial terminal?

Thanks in advance