Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Novice
958 Views

read hc 04 distance sensor intel edison C code

Hi,

I would like to implement HC 04 sensor integration on intel edison board. I can read the values of sensor and calculate distance by arduino code from "pulseIn" function call. But I want to implement the same in C code. Can some one guide me how to implement reading the sensor value in C code.

Thanks in advance

Regards,

Pavan

4 Replies
Highlighted
Novice
30 Views

Hi,

A small update on my post. My requirement is to read the data from sensor connected on intel edison board and post it to cloud.For sending data to the cloud I am using curl libraries and post method. I am already done with the C code to post to cloud. But I could n't read the data from arduino code into my c code. So I am looking to implement the HC 04 distance sensor reading in C code.

Any suggestions on getting it done would be of great help

Regards,

Pavan

0 Kudos
Highlighted
Employee
30 Views

Hello u2bpavankumar,

What do you mean by "I could n't read the data from arduino code into my c code"? Are you able to use the sensor with the Arduino sketch, or do you have problems with the sensor regardless if you are programming in C or through an Arduino sketch?

In your first post, when you mention that you are able to read values from the sensor using the Arduino sketch, are you using the Edison Arduino Expansion board or an Arduino UNO?

Regards,

Diego.

0 Kudos
Highlighted
Novice
30 Views

Hi Diego,

Thanks for your reply.

I am using Edison Arduino Expansion board. I can read the sensor value from arduino code. But now I need to pass on this data to my c code so that I can send this data to cloud. I am looking for accessing the data read in arduino code into the c code

Regards,

Pavan

0 Kudos
Highlighted
Employee
30 Views

Hello u2bpavankumar,

The only way to pass data from an Arduino sketch to a C script (or other environment), is through a text file. You would have to save the data in a file, created by the Arduino sketch. Then, in the C script, you would have to open that file and read the data saved by the Arduino sketch. The following document discusses the data sharing between environments, you might find it interesting: https://software.intel.com/en-us/blogs/2015/05/05/efficient-data-sharing-using-interrupts-on-intel-e... IoT - Data sharing between programming environments on Intel® Edison | Intel® Developer Zone

Regards,

Diego.

0 Kudos