There are some issues with one-wire devices such as the DS18x20 sensors. Some users have been trying to use one-wire devices with no success with Galileo. The issue is caused by the Galileo's I/O speed. Please check the following threads about this topic:
- Intel Galileo OneWire and Dallas Temperature Arduino Code not working
- One Wire Digital Temperature Sensor - DS18B20
The threads above discuss the use of the DS18x20 sensors. Also, in the second thread there is an user who was able to use the sensor successfully, but he had to create a library to make it work, so you will probably have to do the same since the libraries already available are not compatible with the way the sensor works.
I tried the below following Arduino code .
// Data wire is plugged into pin 2 on the Arduino
#define ONE_WIRE_BUS 2
// Setup a oneWire instance to communicate with any OneWire devices
// (not just Maxim/Dallas temperature ICs)
// Pass our oneWire reference to Dallas Temperature.
// start serial port
Serial.println("Dallas Temperature IC Control Library Demo");
// Start up the library
// call sensors.requestTemperatures() to issue a global temperature
// request to all devices on the bus
Serial.print(" Requesting temperatures...");
sensors.requestTemperatures(); // Send the command to get temperatures
Serial.print("Temperature for Device 1 is: ");
Serial.print(sensors.getTempCByIndex(0)); // Why "byIndex"?
// You can have more than one IC on the same bus.
// 0 refers to the first IC on the wire
After compiling in Arduino IDE the following warning will come.
WARNING: library OneWire claims to run on [i585-uclibc] architecture(s) and may be incompatible with your current board which runs on [i586-uclibc] architecture(s).
But i want how to interface DS1820 using MRAA libraries .
The message you got is because of the Arduino IDE version that you are using. I recommend you to use the Arduino IDE 1.6.0 which is the most stable version to work with Galileo and Edison boards: http://downloadmirror.intel.com/24783/eng/IntelArduino-1.6.0-Windows.7z
On the other hand, as I explained to you in my previous post, there are issues with the one-wire devices. These issues are caused by the Galileo's I/O speed. This means that regardless of the library used, the issues are going to be present. Unfortunately, there are not MRAA examples for one-wire devices. In the following thread a user was able to make the sensor work but he wrote his own library for it: One Wire Digital Temperature Sensor - DS18B20
You can try to write your own library too, based on the Arduino OneWire library and the MRAA library, but as I said, there are not MRAA examples for one-wire devices.
Additionally, in the following threads you will find interesting information about working with one-wire devices in Galileo and the I/O speed, which is the main issue with these devices:
- Re: Intel Galileo OneWire and Dallas Temperature Arduino Code not working
- Using Galileo to read 1-Wire (such as iButton) devices.
In Intel Galileo Gen 2 in between I/O and Quark processor MUX/SHIFT is there.
But an Arduino board means there is no MUX in between I/O port and ATMEGA controller. I/O directly connected to ATMEGA controller.
May be that reason we can't interface 1-wire device with Galileo Gen 2.