Code Monkey home page Code Monkey logo

dht22-pine64's People

Contributors

ayufan avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

dht22-pine64's Issues

<pin-number>

Which of these numbers should I use for the highlighted string for pin-number: "7", "71", "17" or "11"?
Pine64_GPIO.jpg

Invalid CRC or Not enough bits

First of all the code works pretty well and I can easily work around the issue! But sometimes I get random errors like "Invalid CRC" or "Not enough bits". I get what is going on there in the code, I just dont know if it is an issue with my hardware, some timing issue or a sensor issue.

Is that normal?

Thanks in advance.

$dht22 -p 71 -d 1000

Humidity: 44.1 %
Temperature: 29.2 *C
Humidity: 44.0 %
Temperature: 29.2 *C
Humidity: 44.0 %
Temperature: 29.1 *C
Humidity: 44.0 %
Temperature: 29.1 *C
Invalid CRC
Not enough bits: 0
Not enough bits: 0
Not enough bits: 0
Humidity: 44.0 %
Temperature: 29.1 *C
Humidity: 43.9 %
Temperature: 29.1 *C
Humidity: 44.0 %
Temperature: 29.1 *C
Not enough bits: 39
Not enough bits: 0
Not enough bits: 0
Not enough bits: 0
Humidity: 44.0 %
Temperature: 29.1 *C

DHT22 on rockpro64 with armbian buster

Hi,

We are trying to use it but having segmentation fault each time and we are having a bunch of warning while me "make" it!

g++ -fpermissive -Wno-write-strings -o dht22 .c
c_gpio.c: In function ‘int setup()’:
c_gpio.c:129:23: warning: cast from ‘volatile uint32_t
’ {aka ‘volatile unsigned int*’} to ‘uint32_t’ {aka ‘unsigned int’} loses precision [-fpermissive]
if ((uint32_t)gpio_map < 0) {
^~~~~~~~
c_gpio.c:176:27: warning: invalid conversion from ‘void*’ to ‘uint8_t*’ {aka ‘unsigned char*’} [-fpermissive]
if ((gpio_mem = malloc(BLOCK_SIZE + (PAGE_SIZE-1))) == NULL)
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
c_gpio.c:179:19: warning: cast from ‘uint8_t*’ {aka ‘unsigned char*’} to ‘uint32_t’ {aka ‘unsigned int’} loses precision [-fpermissive]
if ((uint32_t)gpio_mem % PAGE_SIZE)
^~~~~~~~
c_gpio.c:180:44: warning: cast from ‘uint8_t*’ {aka ‘unsigned char*’} to ‘uint32_t’ {aka ‘unsigned int’} loses precision [-fpermissive]
gpio_mem += PAGE_SIZE - ((uint32_t)gpio_mem % PAGE_SIZE);
^~~~~~~~
c_gpio.c:189:19: warning: cast from ‘volatile uint32_t*’ {aka ‘volatile unsigned int*’} to ‘uint32_t’ {aka ‘unsigned int’} loses precision [-fpermissive]
if ((uint32_t)gpio_map < 0)
^~~~~~~~
c_gpio.c: In function ‘uint32_t sunxi_readl(volatile uint32_t*)’:
c_gpio.c:282:36: warning: cast from ‘volatile uint32_t*’ {aka ‘volatile unsigned int*’} to ‘uint32_t’ {aka ‘unsigned int’} loses precision [-fpermissive]
uint32_t mmap_base = (uint32_t)addr & (~MAP_MASK);
^~~~
c_gpio.c:283:37: warning: cast from ‘volatile uint32_t*’ {aka ‘volatile unsigned int*’} to ‘uint32_t’ {aka ‘unsigned int’} loses precision [-fpermissive]
uint32_t mmap_seek = ((uint32_t)addr - mmap_base) >> 2;
^~~~
c_gpio.c: In function ‘void sunxi_writel(volatile uint32_t*, uint32_t)’:
c_gpio.c:290:36: warning: cast from ‘volatile uint32_t*’ {aka ‘volatile unsigned int*’} to ‘uint32_t’ {aka ‘unsigned int’} loses precision [-fpermissive]
uint32_t mmap_base = (uint32_t)addr & (~MAP_MASK);
^~~~
c_gpio.c:291:37: warning: cast from ‘volatile uint32_t*’ {aka ‘volatile unsigned int*’} to ‘uint32_t’ {aka ‘unsigned int’} loses precision [-fpermissive]
uint32_t mmap_seek =( (uint32_t)addr - mmap_base) >> 2;
^~~~
c_gpio.c: In function ‘int eventdetected(int)’:
c_gpio.c:219:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.