[riot-users] How to use SAUL?

Philipp Blum philipp-blum at jakiku.de
Wed Mar 20 14:04:33 CET 2019


 

Hi, 

I just want to use the DHT11 sensor. I know that RIOT has an abstraction
layer for sensors, which is really nice. My problem is just: How to use
it? I have a server on my device which accepts UDP packets. The server
should read the sensor data on a regular base, caches them and sends
them back when asked. So, simple as that. Probably I have add the
modules for my driver and saul, right? So my Makefile should look like
this 

 USEMDOULE += saul 

USEMODULE += dht 

The dht driver already has confgurations, which I need to override,
since the pins are not correct. Should I just do the following in my
application? 

 #undef DHT_PARAM_PIN 

#define DHT_PARAM_PIN (GPIO_PIN(0, 12)) 

or should I define the DHT_PARAMS? When the setup is done, I probably
just need to use saul itself with: 

 const char temp_sensor_name[] = "dht"; phydat_t temp_data; saul_reg_t *
temp_sensor_reg = saul_reg_find_name(temp_sensor_name);
saul_reg_read(temp_sensor_reg, &temp_data); 

right? thanks for the help :) 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/users/attachments/20190320/9aadbbff/attachment.html>


More information about the users mailing list