Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor I
886 Views

Sleep vs Delay effect on UART read/write

Hey guys, I was actually wondering as to whether there is a delay function for galileo(Not sleep)?

The major difference between them from my experience of arduino and galileo, is that sleep pauses the entire CPU for that amount of time whereas delay also does something simlar to that but allows other functions to run in the mean time.

For example I am working on the UART port in the galileo.So now when I am performing a sleep function during a uart_read, does that mean whatever is the incoming bytes on the rx pin will be ignored ?

But in the case of arduino I had never encountered such a problem

Finally I have two questions

1.Is there a C library for delay function

2.Clarity on sleep vs delay

Thanks

nathan

7 Replies
Highlighted
Honored Contributor I
11 Views

Hi,

Are you asking about an alternative for Arduino sketches running in Galileo?

The major difference between them from my experience of arduino and galileo, is that sleep pauses the entire CPU for that amount of time whereas delay also does something simlar to that but allows other functions to run in the mean time.

How do you figure out this behavior? Arduino and Galileo?

Fernando.

0 Kudos
Highlighted
New Contributor I
11 Views

Actually I treid using sleep in the case where, I had to write consecutive AT commands with a delay in between.

Also during this sleep time I wanted to read the reply from the uart device

which was not possible when I used sleep in galileo.

delay is not there by default in galileo c programming.

correct me if I am wrong

Do u know any equivalents of delay in galileo?

0 Kudos
Highlighted
Honored Contributor I
11 Views

KS_Nathan wrote:

Actually I treid using sleep in the case where, I had to write consecutive AT commands with a delay in between.

Also during this sleep time I wanted to read the reply from the uart device

which was not possible when I used sleep in galileo.

delay is not there by default in galileo c programming.

correct me if I am wrong

Do u know any equivalents of delay in galileo?

Hmmm... I think I do not fully understand... how are you developing your applications? what IDE are you using (or none)?

Maybe it's not the most elegant:

do {

receive from UART, if something available

} while not elapsed the delay

HTH,

Fernando.

0 Kudos
Highlighted
New Contributor I
11 Views

I am using Eclipse IDE

0 Kudos
Highlighted
Honored Contributor I
11 Views

KS_Nathan wrote:

I am using Eclipse IDE

This is why I didn´t understand, I don't use Eclipse. I won't be able to help, sorry.

Fernando.

0 Kudos
Highlighted
New Contributor I
11 Views

K have u been able to use arduino ethernet library with galilleo?

coz I am having trouble working with it.

Whenever I am trying to print the ethernet.LocalIp() it is giving 255.255.255.255

Any references/suggestions/solutions from your side?

nathan

0 Kudos
Highlighted
Honored Contributor I
11 Views

KS_Nathan wrote:

K have u been able to use arduino ethernet library with galilleo?

coz I am having trouble working with it.

Whenever I am trying to print the ethernet.LocalIp() it is giving 255.255.255.255

Any references/suggestions/solutions from your side?

nathan

I think there is no way of using that library's specific function ...

If you are not setting the IP and you want to know the IP received by the DHCP server, then you should use some other method... e.g. some system() command

If you set the IP (a static one) then you do not need to get the IP from the library.

HTH,

Fernando.

0 Kudos