Power & Source of Big Ideas

Matrix 1-wire problem

Moderators: chensy, FATechsupport

I am trying to read DS18B20 1-wire sensors using code adapted from the Matrix Temperature sensor example, as found at Armworks. I have noticed that the current Wiki example is quite different and appears NOT to be suitable for the NanoPi.


Code: Select all

//temp sensors

  if ((devFD = ds18b20Init(GPIO_PIN1)) == -1)
  {
    printf("Fail to init ds18b20\n");
    return -1;
  }
 
  if (ds18b20Read(temperature1) > 0)
  {
    printf("HotWaterTemp = %s\n", temperature1);
  }
  else
  {
    printf("Fail to get HotWaterTemp\n");      
  }

  hot_water_temp = atoi (temperature1);
  free(temperature1);
  ds18b20DeInit(devFD);

and periodically can get the following error:

Code: Select all

FAHW-Lib: Fail to read /sys/devices/w1_bus_master1/w1_master_max_slave_count/w1_slave

Appreciate any comments.

Thanks,
davef
Hi,
Our matrix accessories Matrix-Temperature_Sensor is used with DS18B20, inside the example you can refer to
http://wiki.friendlyarm.com/wiki/index. ... _Sensor/zh
Thanks!
chensy,

I believe that for the NanoPi I would need a significantly different code base. For example, with the NanoPi everything is compiled-in and does not use modules.

I lose about 5% of my readings, which is not a significant problem for me.

Thanks anyhow.

Dave

Who is online

In total there are 3 users online :: 0 registered, 0 hidden and 3 guests (based on users active over the past 5 minutes)
Most users ever online was 5185 on Wed Jan 22, 2020 1:44 pm

Users browsing this forum: No registered users and 3 guests