Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Arduino Code for various Sensors modified to work in the pico-c-sdk

License

NotificationsYou must be signed in to change notification settings

mwinters-stuff/pico-sensor-devices

Repository files navigation

Arduino Code for various Sensors modified to work in the pico-c-sdk

Sensors

  • DHT22, Temperature and Humidity
  • BH1750, Light (Lux)
  • INA226, Voltage and Current
  • PCF8563, RTC
  • VEML6070, UV (Ultra Violet)
  • BMP085/BMP180, Temperature and Atmospheric Pressure
  • PCF8591, 8-bit A/D and D/A converter
  • PCF8575, 16 port I/O Expander
  • AT25Cx, EEPROM
  • PCA9548A, I2C Mux

Feel free to issue PR's with additional devices.

Wire

All the sensors apart from the DHT22 are I2C sensors, most of these are compatible with the arduino sensor code,the wire class provides a compatible interface and is used by the sensors.

Each sensor class holds its own instance of wire, a "begin" method has been added or modified to pass in thepico i2c device.

The newer classes just read/write to I2C as the code was written by me and help of copilot.

Using

To use the library, follow these steps, it will be similar to that you would have used to use the "pico-extras" library.

  1. Download thepico_sensors_import.cmake file to the root of your project.

    wgethttps://github.com/mwinters-stuff/pico-sensor-devices/blob/master/pico_sensors_import.cmake

  2. Add the following lines to yourCMakeLists.txt before thepico_sdk_init() call
       set(PICO_SENSORS_FETCH_FROM_GIT 1)   include(pico_sensors_import.cmake)
  3. Target the libraries you are using, each one is prefixedsensor_:
     target_link_libraries(my-project-name   sensor_ADS1X15   sensor_AT24Cx   sensor_BH1750   sensor_BMP085   sensor_DHT22   sensor_INA226   sensor_PCF8563   sensor_PCF8575   sensor_PCF8591   sensor_VEML6070 )
  4. In your code, include the header you need, if you didnt target the sensor then the header wont be found.
    #include"sensor/ADS1X15.h"#include"sensor/AT24Cx.h"#include"sensor/BH1750.h"#include"sensor/BMP085.h"#include"sensor/DHT22.h"#include"sensor/INA226.h"#include"sensor/PCF8563.h"#include"sensor/PCF8575.h"#include"sensor/PCF8591.h"#include"sensor/VEML6070.h"
  5. Look in the examples directory, cmake will give you the targets to run and code.

About

Arduino Code for various Sensors modified to work in the pico-c-sdk

Topics

Resources

License

Stars

Watchers

Forks

Contributors3

  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp